- Timestamp:
- Jul 24, 2015 6:43:41 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r57045 r57076 147 147 # include <QNetworkProxy> 148 148 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 149 #include <QReadLocker>150 149 #include <QSettings> 151 150 #include <QStyleOptionSpinBox> … … 1548 1547 void VBoxGlobal::createMedium(const UIMedium &medium) 1549 1548 { 1550 /* Create medium in medium-enumerator: */ 1551 QReadLocker cleanupRacePreventor(&m_mediumEnumeratorDtorRwLock); 1552 if (m_pMediumEnumerator) 1553 m_pMediumEnumerator->createMedium(medium); 1549 if (m_mediumEnumeratorDtorRwLock.tryLockForRead()) 1550 { 1551 /* Create medium in medium-enumerator: */ 1552 if (m_pMediumEnumerator) 1553 m_pMediumEnumerator->createMedium(medium); 1554 m_mediumEnumeratorDtorRwLock.unlock(); 1555 } 1554 1556 } 1555 1557 1556 1558 void VBoxGlobal::deleteMedium(const QString &strMediumID) 1557 1559 { 1558 /* Delete medium from medium-enumerator: */ 1559 QReadLocker cleanupRacePreventor(&m_mediumEnumeratorDtorRwLock); 1560 if (m_pMediumEnumerator) 1561 m_pMediumEnumerator->deleteMedium(strMediumID); 1560 if (m_mediumEnumeratorDtorRwLock.tryLockForRead()) 1561 { 1562 /* Delete medium from medium-enumerator: */ 1563 if (m_pMediumEnumerator) 1564 m_pMediumEnumerator->deleteMedium(strMediumID); 1565 m_mediumEnumeratorDtorRwLock.unlock(); 1566 } 1562 1567 } 1563 1568 … … 1734 1739 return; 1735 1740 1736 /* Redirect request to medium-enumerator: */ 1737 QReadLocker cleanupRacePreventor(&m_mediumEnumeratorDtorRwLock); 1738 if (m_pMediumEnumerator) 1739 m_pMediumEnumerator->enumerateMediums(); 1741 if (m_mediumEnumeratorDtorRwLock.tryLockForRead()) 1742 { 1743 /* Redirect request to medium-enumerator: */ 1744 if (m_pMediumEnumerator) 1745 m_pMediumEnumerator->enumerateMediums(); 1746 m_mediumEnumeratorDtorRwLock.unlock(); 1747 } 1740 1748 } 1741 1749 … … 1749 1757 UIMedium VBoxGlobal::medium(const QString &strMediumID) const 1750 1758 { 1751 /* Redirect call to medium-enumerator: */ 1752 QReadLocker cleanupRacePreventor(&m_mediumEnumeratorDtorRwLock); 1753 if (m_pMediumEnumerator) 1754 return m_pMediumEnumerator->medium(strMediumID); 1759 if (m_mediumEnumeratorDtorRwLock.tryLockForRead()) 1760 { 1761 /* Redirect call to medium-enumerator: */ 1762 UIMedium result; 1763 if (m_pMediumEnumerator) 1764 result = m_pMediumEnumerator->medium(strMediumID); 1765 m_mediumEnumeratorDtorRwLock.unlock(); 1766 return result; 1767 } 1755 1768 return UIMedium(); 1756 1769 } … … 1758 1771 QList<QString> VBoxGlobal::mediumIDs() const 1759 1772 { 1760 /* Redirect call to medium-enumerator: */ 1761 QReadLocker cleanupRacePreventor(&m_mediumEnumeratorDtorRwLock); 1762 if (m_pMediumEnumerator) 1763 return m_pMediumEnumerator->mediumIDs(); 1773 if (m_mediumEnumeratorDtorRwLock.tryLockForRead()) 1774 { 1775 /* Redirect call to medium-enumerator: */ 1776 QList<QString> result; 1777 if (m_pMediumEnumerator) 1778 result = m_pMediumEnumerator->mediumIDs(); 1779 m_mediumEnumeratorDtorRwLock.unlock(); 1780 return result; 1781 } 1764 1782 return QList<QString>(); 1765 1783 }
Note:
See TracChangeset
for help on using the changeset viewer.