Changeset 14382 in vbox for trunk/src/VBox
- Timestamp:
- Nov 19, 2008 10:50:38 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp
r14372 r14382 608 608 /** Constructs a regular enum event */ 609 609 VBoxMediaEnumEvent (const VBoxMedium &aMedium, 610 VBoxMediaList:: const_iterator &aIterator)610 VBoxMediaList::iterator &aIterator) 611 611 : QEvent ((QEvent::Type) VBoxDefs::MediaEnumEventType) 612 612 , mMedium (aMedium), mIterator (aIterator), mLast (false) 613 613 {} 614 614 /** Constructs the last enum event */ 615 VBoxMediaEnumEvent ()615 VBoxMediaEnumEvent (VBoxMediaList::iterator &aIterator) 616 616 : QEvent ((QEvent::Type) VBoxDefs::MediaEnumEventType) 617 , m Last (true)617 , mIterator (aIterator), mLast (true) 618 618 {} 619 619 620 /** The last enumerated medium iterator (invalid when #last is true) */ 621 VBoxMediaList::const_iterator mIterator; 622 /** The last enumerated medium (not valid when #last is true) */ 620 /** Last enumerated medium (not valid when #last is true) */ 623 621 const VBoxMedium mMedium; 622 /** Opaque iterator provided by the event sender (guaranteed to be 623 * the same variable for all media in the single enumeration procedure) */ 624 VBoxMediaList::iterator &mIterator; 624 625 /** Whether this is the last event for the given enumeration or not */ 625 626 const bool mLast; … … 2842 2843 public: 2843 2844 2844 MediaEnumThread (const VBoxMediaList &aList) : mList (aList) {} 2845 MediaEnumThread (VBoxMediaList &aList) 2846 : mSavedIt (aList.begin()) 2847 { 2848 for (VBoxMediaList::const_iterator it = aList.begin(); 2849 it != aList.end(); ++ it) 2850 mVector.append (*it); 2851 } 2845 2852 2846 2853 virtual void run() … … 2853 2860 2854 2861 /* Enumerate the list */ 2855 for (VBoxMediaList::const_iterator it = mList.begin(); 2856 it != mList.end() && !sVBoxGlobalInCleanup; ++ it) 2862 for (int i = 0; i < mVector.size() && !sVBoxGlobalInCleanup; ++ i) 2857 2863 { 2858 VBoxMedium medium = *it; 2859 medium.blockAndQueryState(); 2860 QApplication::postEvent (self, new VBoxMediaEnumEvent (medium, it)); 2864 mVector [i].blockAndQueryState(); 2865 QApplication:: 2866 postEvent (self, 2867 new VBoxMediaEnumEvent (mVector [i], mSavedIt)); 2861 2868 } 2862 2869 2863 2870 /* Post the end-of-enumeration event */ 2864 2871 if (!sVBoxGlobalInCleanup) 2865 QApplication::postEvent (self, new VBoxMediaEnumEvent ());2872 QApplication::postEvent (self, new VBoxMediaEnumEvent (mSavedIt)); 2866 2873 2867 2874 COMBase::CleanupCOM(); … … 2871 2878 private: 2872 2879 2873 const VBoxMediaList &mList; 2880 QVector <VBoxMedium> mVector; 2881 VBoxMediaList::iterator mSavedIt; 2874 2882 }; 2875 2883 … … 4950 4958 vboxProblem().cannotGetMediaAccessibility (ev->mMedium); 4951 4959 Assert (ev->mIterator != mMediaList.end()); 4952 VBoxMedium *medium = unconst (&*ev->mIterator);4953 *medium = ev->mMedium;4954 emit mediumEnumerated (*medium);4960 *(ev->mIterator) = ev->mMedium; 4961 emit mediumEnumerated (*ev->mIterator); 4962 ++ ev->mIterator; 4955 4963 } 4956 4964 else
Note:
See TracChangeset
for help on using the changeset viewer.