Changeset 98836 in vbox
- Timestamp:
- Mar 3, 2023 9:36:21 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r98351 r98836 5137 5137 if (devType == DeviceType_HardDisk) 5138 5138 m->mapHardDisks[id] = pMedium; 5139 5140 mediumCaller.release(); 5141 mediaTreeLock.release(); 5142 *ppMedium = pMedium; 5143 } 5144 else 5139 } 5140 5141 /* 5142 * If we have been called from Medium::initFromSettings() then the Medium object's 5143 * AutoCaller status will be 'InInit' which means that when making the assigment to 5144 * ppMedium below the Medium object will not call Medium::uninit(). By excluding 5145 * this code path from releasing and reacquiring the media tree lock we avoid a 5146 * potential deadlock with other threads which may be operating on the 5147 * disks/DVDs/floppies in the VM's media registry at the same time such as 5148 * Machine::unregister(). 5149 */ 5150 if (!fCalledFromMediumInit) 5145 5151 { 5146 5152 // pMedium may be the last reference to the Medium object, and the … … 5153 5159 // must not hold the media tree write lock any more 5154 5160 Assert(!i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 5155 *ppMedium = pDupMedium; 5156 } 5161 } 5162 5163 *ppMedium = pDupMedium.isNull() ? pMedium : pDupMedium; 5157 5164 5158 5165 if (fAddToGlobalRegistry) … … 5167 5174 // Restore the initial lock state, so that no unexpected lock changes are 5168 5175 // done by this method, which would need adjustments everywhere. 5169 mediaTreeLock.acquire(); 5176 if (!fCalledFromMediumInit) 5177 mediaTreeLock.acquire(); 5170 5178 5171 5179 return hrc;
Note:
See TracChangeset
for help on using the changeset viewer.