- Timestamp:
- May 14, 2013 10:55:46 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r45971 r46056 4032 4032 * and return, nothing else to do */ 4033 4033 mMediaData->mAttachments.push_back(pAttachTemp); 4034 4035 /* Reattach the medium to the VM. */ 4036 if (fHotplug || fSilent) 4037 { 4038 mediumLock.release(); 4039 treeLock.release(); 4040 alock.release(); 4041 4042 MediumLockList *pMediumLockList(new MediumLockList()); 4043 4044 rc = medium->createMediumLockList(true /* fFailIfInaccessible */, 4045 true /* fMediumLockWrite */, 4046 NULL, 4047 *pMediumLockList); 4048 alock.acquire(); 4049 if (FAILED(rc)) 4050 delete pMediumLockList; 4051 else 4052 { 4053 mData->mSession.mLockedMedia.Unlock(); 4054 alock.release(); 4055 rc = mData->mSession.mLockedMedia.Insert(pAttachTemp, pMediumLockList); 4056 mData->mSession.mLockedMedia.Lock(); 4057 alock.acquire(); 4058 } 4059 alock.release(); 4060 4061 if (SUCCEEDED(rc)) 4062 { 4063 rc = onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent); 4064 /* Remove lock list in case of error. */ 4065 if (FAILED(rc)) 4066 { 4067 mData->mSession.mLockedMedia.Unlock(); 4068 mData->mSession.mLockedMedia.Remove(pAttachTemp); 4069 mData->mSession.mLockedMedia.Lock(); 4070 } 4071 } 4072 } 4073 4034 4074 return S_OK; 4035 4075 } … … 4091 4131 * and return, nothing else to do */ 4092 4132 mMediaData->mAttachments.push_back(*it); 4133 4134 /* Reattach the medium to the VM. */ 4135 if (fHotplug || fSilent) 4136 { 4137 mediumLock.release(); 4138 treeLock.release(); 4139 alock.release(); 4140 4141 MediumLockList *pMediumLockList(new MediumLockList()); 4142 4143 rc = medium->createMediumLockList(true /* fFailIfInaccessible */, 4144 true /* fMediumLockWrite */, 4145 NULL, 4146 *pMediumLockList); 4147 alock.acquire(); 4148 if (FAILED(rc)) 4149 delete pMediumLockList; 4150 else 4151 { 4152 mData->mSession.mLockedMedia.Unlock(); 4153 alock.release(); 4154 rc = mData->mSession.mLockedMedia.Insert(pAttachTemp, pMediumLockList); 4155 mData->mSession.mLockedMedia.Lock(); 4156 alock.acquire(); 4157 } 4158 alock.release(); 4159 4160 if (SUCCEEDED(rc)) 4161 { 4162 rc = onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent); 4163 /* Remove lock list in case of error. */ 4164 if (FAILED(rc)) 4165 { 4166 mData->mSession.mLockedMedia.Unlock(); 4167 mData->mSession.mLockedMedia.Remove(pAttachTemp); 4168 mData->mSession.mLockedMedia.Lock(); 4169 } 4170 } 4171 } 4172 4093 4173 return S_OK; 4094 4174 }
Note:
See TracChangeset
for help on using the changeset viewer.