- Timestamp:
- Oct 5, 2013 10:39:42 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r48826 r48906 25 25 #include <QDesktopServices> 26 26 #include <QMutex> 27 #include <QReadLocker> 27 28 #include <QToolButton> 28 29 #include <QProcess> … … 943 944 944 945 /* Search for corresponding UI medium again: */ 946 945 947 uimedium = medium(strMediumID); 946 948 if (uimedium.isNull()) … … 1664 1666 { 1665 1667 /* Create medium in medium-enumerator: */ 1666 m_pMediumEnumerator->createMedium(medium); 1668 QReadLocker cleanupRacePreventor(&m_mediumEnumeratorDtorRwLock); 1669 if (m_pMediumEnumerator) 1670 m_pMediumEnumerator->createMedium(medium); 1667 1671 } 1668 1672 … … 1670 1674 { 1671 1675 /* Update medium of medium-enumerator: */ 1672 m_pMediumEnumerator->updateMedium(medium); 1676 QReadLocker cleanupRacePreventor(&m_mediumEnumeratorDtorRwLock); 1677 if (m_pMediumEnumerator) 1678 m_pMediumEnumerator->updateMedium(medium); 1673 1679 } 1674 1680 … … 1676 1682 { 1677 1683 /* Delete medium from medium-enumerator: */ 1678 m_pMediumEnumerator->deleteMedium(strMediumID); 1684 QReadLocker cleanupRacePreventor(&m_mediumEnumeratorDtorRwLock); 1685 if (m_pMediumEnumerator) 1686 m_pMediumEnumerator->deleteMedium(strMediumID); 1679 1687 } 1680 1688 … … 1841 1849 1842 1850 /* Redirect request to medium-enumerator: */ 1843 m_pMediumEnumerator->enumerateMediums(); 1851 QReadLocker cleanupRacePreventor(&m_mediumEnumeratorDtorRwLock); 1852 if (m_pMediumEnumerator) 1853 m_pMediumEnumerator->enumerateMediums(); 1844 1854 } 1845 1855 … … 1847 1857 { 1848 1858 /* Redirect request to medium-enumerator: */ 1849 return m_pMediumEnumerator->isMediumEnumerationInProgress(); 1859 return m_pMediumEnumerator 1860 && m_pMediumEnumerator->isMediumEnumerationInProgress(); 1850 1861 } 1851 1862 … … 1853 1864 { 1854 1865 /* Redirect call to medium-enumerator: */ 1855 return m_pMediumEnumerator->medium(strMediumID); 1866 QReadLocker cleanupRacePreventor(&m_mediumEnumeratorDtorRwLock); 1867 if (m_pMediumEnumerator) 1868 return m_pMediumEnumerator->medium(strMediumID); 1869 return UIMedium(); 1856 1870 } 1857 1871 … … 1859 1873 { 1860 1874 /* Redirect call to medium-enumerator: */ 1861 return m_pMediumEnumerator->mediumIDs(); 1875 QReadLocker cleanupRacePreventor(&m_mediumEnumeratorDtorRwLock); 1876 if (m_pMediumEnumerator) 1877 return m_pMediumEnumerator->mediumIDs(); 1878 return QList<QString>(); 1862 1879 } 1863 1880 … … 4352 4369 4353 4370 /* Cleanup medium-enumerator: */ 4371 m_mediumEnumeratorDtorRwLock.lockForWrite(); 4354 4372 delete m_pMediumEnumerator; 4355 4373 m_pMediumEnumerator = 0; 4374 m_mediumEnumeratorDtorRwLock.unlock(); 4356 4375 4357 4376 if (mSelectorWnd) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r48314 r48906 1 1 /** @file 2 * 3 * VBox frontends: Qt GUI ("VirtualBox"): 4 * VBoxGlobal class declaration 2 * VBox Qt GUI - VBoxGlobal class declaration. 5 3 */ 6 4 … … 17 15 */ 18 16 19 #ifndef __ VBoxGlobal_h__20 #define __ VBoxGlobal_h__17 #ifndef ___VBoxGlobal_h___ 18 #define ___VBoxGlobal_h___ 21 19 22 20 /* Qt includes: */ … … 27 25 #include <QHash> 28 26 #include <QFileIconProvider> 27 #include <QReadWriteLock> 29 28 #ifdef Q_WS_MAC 30 29 # include <QSet> … … 73 72 74 73 bool isValid() { return mValid; } 74 bool isCleaningUp() { return m_sfCleanupInProgress; } 75 75 76 76 static QString qtRTVersionString(); … … 429 429 /* Variable: Medium-enumeration stuff: */ 430 430 UIMediumEnumerator *m_pMediumEnumerator; 431 mutable QReadWriteLock m_mediumEnumeratorDtorRwLock; 431 432 432 433 RenderMode vm_render_mode; … … 509 510 inline VBoxGlobal& vboxGlobal() { return *VBoxGlobal::instance(); } 510 511 511 #endif /* __VBoxGlobal_h__ */512 512 #endif /* !___VBoxGlobal_h___ */ 513 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp
r48893 r48906 1 1 /* $Id$ */ 2 2 /** @file 3 * 4 * VBox frontends: Qt GUI ("VirtualBox"): 5 * UIMediumEnumerator class implementation 3 * VBox Qt GUI - UIMediumEnumerator class implementation. 6 4 */ 7 5 … … 166 164 addMediumsToMap(vboxGlobal().host().GetFloppyDrives(), mediums, UIMediumType_Floppy); 167 165 addMediumsToMap(vboxGlobal().virtualBox().GetFloppyImages(), mediums, UIMediumType_Floppy); 166 if (vboxGlobal().isCleaningUp()) 167 return; /* VBoxGlobal is cleaning up, abort immediately. */ 168 168 m_mediums = mediums; 169 169 … … 316 316 foreach (CMedium medium, inputMediums) 317 317 { 318 /* If VBoxGlobal is cleaning up, abort immediately: */ 319 if (vboxGlobal().isCleaningUp()) 320 break; 321 318 322 /* Prepare uimedium on the basis of current medium: */ 319 323 QString strMediumID = medium.GetId(); … … 332 336 foreach (CMedium medium, inputMediums) 333 337 { 338 /* If VBoxGlobal is cleaning up, abort immediately: */ 339 if (vboxGlobal().isCleaningUp()) 340 break; 341 334 342 /* Prepare uimedium on the basis of current medium: */ 335 343 QString strMediumID = medium.GetId(); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h
r48276 r48906 1 1 /** @file 2 * 3 * VBox frontends: Qt GUI ("VirtualBox"): 4 * UIMediumEnumerator class declaration 2 * VBox Qt GUI - UIMediumEnumerator class declaration. 5 3 */ 6 4 … … 17 15 */ 18 16 19 #ifndef __ UIMediumEnumerator_h__20 #define __ UIMediumEnumerator_h__17 #ifndef ___UIMediumEnumerator_h___ 18 #define ___UIMediumEnumerator_h___ 21 19 22 20 /* Qt includes: */ … … 88 86 }; 89 87 90 #endif /* __UIMediumEnumerator_h__ */ 88 #endif /* !___UIMediumEnumerator_h___ */ 89 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp
r48831 r48906 62 62 UIGDetailsElementInterface::~UIGDetailsElementInterface() 63 63 { 64 /* VBoxGlobal must still be valid at this point, otherwise our thread might 65 be doing really bad things to already deleted memory! */ 66 Assert(vboxGlobal().isValid()); 67 Assert(!vboxGlobal().isCleaningUp()); 68 64 69 cleanupThread(); 65 70 }
Note:
See TracChangeset
for help on using the changeset viewer.