VirtualBox

Changeset 17260 in vbox for trunk


Ignore:
Timestamp:
Mar 3, 2009 9:16:15 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
43608
Message:

#3551: “Main: Replace remaining collections with safe arrays”
Replace SnapshotCollection. Reviewed by dmik. Tested with GUI.

Location:
trunk/src/VBox
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r17078 r17260  
    6666
    6767    /* get the children */
    68     ComPtr<ISnapshotCollection> coll;
    69     rootSnapshot->COMGETTER(Children)(coll.asOutParam());
    70     if (coll)
    71     {
    72         ComPtr<ISnapshotEnumerator> enumerator;
    73         coll->Enumerate(enumerator.asOutParam());
    74         ULONG index = 0;
    75         BOOL hasMore = FALSE;
    76         while (enumerator->HasMore(&hasMore), hasMore)
    77         {
    78             ComPtr<ISnapshot> snapshot;
    79             enumerator->GetNext(snapshot.asOutParam());
     68    SafeIfaceArray <ISnapshot> coll;
     69    rootSnapshot->COMGETTER(Children)(ComSafeArrayAsOutParam(coll));
     70    if (!coll.isNull())
     71    {
     72        for (size_t index = 0; index < coll.size(); ++index)
     73        {
     74            ComPtr<ISnapshot> snapshot = coll[index];
    8075            if (snapshot)
    8176            {
     
    8883                showSnapshots(snapshot, details, newPrefix, level + 1);
    8984            }
    90             index++;
    9185        }
    9286    }
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r17255 r17260  
    26712671                               regExp.cap (1).toInt() : maxSnapShotIndex;
    26722672        /* Traversing to the next child */
    2673         index = index.GetChildren().GetItemAt (0);
     2673        index = index.GetChildren()[0];
    26742674    }
    26752675    dlg.mLeName->setText (snapShotName.arg (maxSnapShotIndex + 1));
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotsWgt.cpp

    r13580 r17260  
    800800    }
    801801
    802     CSnapshotEnumerator en = aSnapshot.GetChildren().Enumerate();
    803     while (en.HasMore())
    804     {
    805         CSnapshot sn = en.GetNext();
     802    CSnapshotVector snapvec = aSnapshot.GetChildren();
     803    for (int i = 0; i < snapvec.size(); ++i)
     804    {
     805        CSnapshot sn = snapvec[i];
    806806        populateSnapshots (sn, si);
    807807    }
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r15051 r17260  
    284284}
    285285
    286 STDMETHODIMP Snapshot::COMGETTER(Children) (ISnapshotCollection **aChildren)
    287 {
    288     CheckComArgOutPointerValid(aChildren);
     286STDMETHODIMP Snapshot::COMGETTER(Children) (ComSafeArrayOut (ISnapshot *, aChildren))
     287{
     288    CheckComArgOutSafeArrayPointerValid(aChildren);
    289289
    290290    AutoWriteLock alock (this);
     
    293293    AutoWriteLock chLock (childrenLock ());
    294294
    295     ComObjPtr <SnapshotCollection> collection;
    296     collection.createObject();
    297     collection->init (children());
    298     collection.queryInterfaceTo (aChildren);
     295    SafeIfaceArray <ISnapshot> collection (children());
     296    collection.detachTo (ComSafeArrayOutArg (aChildren));
    299297
    300298    return S_OK;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r17255 r17260  
    74577457  -->
    74587458
    7459   <enumerator
    7460      name="ISnapshotEnumerator" type="ISnapshot"
    7461      uuid="25cfa2a4-1f1d-4f05-9658-b7a5894ef1a3"
    7462      />
    7463 
    7464   <collection
    7465      name="ISnapshotCollection" type="ISnapshot"
    7466      enumerator="ISnapshotEnumerator"
    7467      uuid="23852e3c-94cd-4801-ab05-ed35675b3894"
    7468      readonly="yes"
    7469      />
    7470 
    74717459  <interface
    74727460     name="ISnapshot" extends="$unknown"
    7473      uuid="9f1bbf79-13b0-4da2-abba-4a992c65c083"
     7461     uuid="5db6b1d9-c76b-4424-a6f4-8257f642d6ea"
    74747462     wsmap="managed"
    74757463     >
     
    76647652    </attribute>
    76657653
    7666     <attribute name="children" type="ISnapshotCollection" readonly="yes">
     7654    <attribute name="children" type="ISnapshot" readonly="yes" safearray="yes">
    76677655      <desc>
    76687656        Child snapshots (all snapshots having this one as a parent).
  • trunk/src/VBox/Main/include/SnapshotImpl.h

    r15051 r17260  
    8787    STDMETHOD(COMGETTER(Machine)) (IMachine **aMachine);
    8888    STDMETHOD(COMGETTER(Parent)) (ISnapshot **aParent);
    89     STDMETHOD(COMGETTER(Children)) (ISnapshotCollection **aChildren);
     89    STDMETHOD(COMGETTER(Children)) (ComSafeArrayOut (ISnapshot *, aChildren));
    9090
    9191    // ISnapshot methods
     
    125125};
    126126
    127 COM_DECL_READONLY_ENUM_AND_COLLECTION (Snapshot)
    128 
    129127#endif // ____H_SNAPSHOTIMPL
    130128
  • trunk/src/VBox/Main/xpcom/server.cpp

    r17255 r17260  
    242242/* collections and enumerators */
    243243
    244 COM_IMPL_READONLY_ENUM_AND_COLLECTION(Snapshot)
    245244#ifdef VBOX_WITH_USB
    246245COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostUSBDevice)
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette