VirtualBox

Changeset 14372 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 19, 2008 6:51:46 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: Slight media-enumeration mechanism fix.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h

    r13950 r14372  
    960960    QThread *mMediaEnumThread;
    961961    VBoxMediaList mMediaList;
    962     VBoxMediaList::iterator mCurrentMediumIterator;
    963962
    964963    VBoxDefs::RenderMode vm_render_mode;
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r14312 r14372  
    607607
    608608    /** Constructs a regular enum event */
    609     VBoxMediaEnumEvent (const VBoxMedium &aMedium)
     609    VBoxMediaEnumEvent (const VBoxMedium &aMedium,
     610                        VBoxMediaList::const_iterator &aIterator)
    610611        : QEvent ((QEvent::Type) VBoxDefs::MediaEnumEventType)
    611         , mMedium (aMedium), mLast (false)
     612        , mMedium (aMedium), mIterator (aIterator), mLast (false)
    612613        {}
    613614    /** Constructs the last enum event */
     
    617618        {}
    618619
     620    /** The last enumerated medium iterator (invalid when #last is true) */
     621    VBoxMediaList::const_iterator mIterator;
    619622    /** The last enumerated medium (not valid when #last is true) */
    620623    const VBoxMedium mMedium;
     
    28332836        }
    28342837    }
    2835     mCurrentMediumIterator = mMediaList.begin();
    28362838
    28372839    /* enumeration thread class */
     
    28512853
    28522854            /* Enumerate the list */
    2853             int index = 0;
    2854             VBoxMediaList::const_iterator it;
    2855             for (it = mList.begin();
    2856                  it != mList.end() && !sVBoxGlobalInCleanup;
    2857                  ++ it, ++ index)
     2855            for (VBoxMediaList::const_iterator it = mList.begin();
     2856                 it != mList.end() && !sVBoxGlobalInCleanup; ++ it)
    28582857            {
    28592858                VBoxMedium medium = *it;
    28602859                medium.blockAndQueryState();
    2861                 QApplication::postEvent (self, new VBoxMediaEnumEvent (medium));
     2860                QApplication::postEvent (self, new VBoxMediaEnumEvent (medium, it));
    28622861            }
    28632862
     
    49504949                    !ev->mMedium.result().isOk())
    49514950                    vboxProblem().cannotGetMediaAccessibility (ev->mMedium);
    4952                 Assert (mCurrentMediumIterator != mMediaList.end());
    4953                 *mCurrentMediumIterator = ev->mMedium;
    4954                 emit mediumEnumerated (*mCurrentMediumIterator);
    4955                 ++ mCurrentMediumIterator;
     4951                Assert (ev->mIterator != mMediaList.end());
     4952                VBoxMedium *medium = unconst (&*ev->mIterator);
     4953                *medium = ev->mMedium;
     4954                emit mediumEnumerated (*medium);
    49564955            }
    49574956            else
     
    49614960                delete mMediaEnumThread;
    49624961                mMediaEnumThread = 0;
    4963                 Assert (mCurrentMediumIterator == mMediaList.end());
    49644962                emit mediumEnumFinished (mMediaList);
    49654963            }
     
    53305328    /* media list contains a lot of CUUnknown, release them */
    53315329    mMediaList.clear();
    5332     mCurrentMediumIterator = mMediaList.end();
    53335330    /* the last step to ensure we don't use COM any more */
    53345331    mVBox.detach();
Note: See TracChangeset for help on using the changeset viewer.

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