vbox的更動 28526 路徑 trunk/src/VBox/Main/MediumImpl.cpp
- 時間撮記:
- 2010-4-20 下午02:05:45 (15 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Main/MediumImpl.cpp
r28401 r28526 2152 2152 /* Apply the normal locking logic to the entire chain. */ 2153 2153 MediumLockList *pMediumLockList(new MediumLockList()); 2154 HRESULT rc = createMediumLockList(true, this, *pMediumLockList);2154 HRESULT rc = diff->createMediumLockList(true, this, *pMediumLockList); 2155 2155 if (FAILED(rc)) 2156 2156 { … … 3101 3101 pMedium = pMedium->getParent(); 3102 3102 if (pMedium.isNull() && pToBeParent) 3103 { 3103 3104 pMedium = pToBeParent; 3105 pToBeParent = NULL; 3106 } 3104 3107 } 3105 3108 … … 4162 4165 else 4163 4166 rc = createMediumLockList(false, NULL, *aMediumLockList); 4164 if (FAILED(rc)) 4165 { 4166 delete aMediumLockList; 4167 aMediumLockList = NULL; 4168 throw rc; 4169 } 4170 4171 /* sanity checking */ 4167 if (FAILED(rc)) throw rc; 4168 4169 /* sanity checking, must be after lock list creation as it depends on 4170 * valid medium states. The medium objects must be accessible. */ 4172 4171 { 4173 4172 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 4247 4246 4248 4247 /* Update medium states appropriately */ 4249 switch (m->state)4250 { 4251 case MediumState_Created:4252 m->state = MediumState_Deleting;4253 break;4254 default:4255 4256 } 4248 if (m->state == MediumState_Created) 4249 { 4250 rc = markForDeletion(); 4251 if (FAILED(rc)) throw rc; 4252 } 4253 else 4254 throw setStateError(); 4255 4257 4256 if (fMergeForward) 4258 4257 { … … 4279 4278 { 4280 4279 AutoWriteLock alock(pLast COMMA_LOCKVAL_SRC_POS); 4281 switch (pLast->m->state)4280 if (pLast->m->state == MediumState_Created) 4282 4281 { 4283 case MediumState_Created: 4284 pLast->m->state = MediumState_Deleting; 4285 break; 4286 default: 4287 throw pLast->setStateError(); 4282 rc = pLast->markForDeletion(); 4283 if (FAILED(rc)) throw rc; 4288 4284 } 4285 else 4286 throw pLast->setStateError(); 4289 4287 } 4290 4288 … … 4507 4505 4508 4506 AssertReturnVoid(aMediumLockList != NULL); 4507 4508 /* Revert media marked for deletion to previous state. */ 4509 HRESULT rc; 4510 MediumLockList::Base::const_iterator mediumListBegin = 4511 aMediumLockList->GetBegin(); 4512 MediumLockList::Base::const_iterator mediumListEnd = 4513 aMediumLockList->GetEnd(); 4514 for (MediumLockList::Base::const_iterator it = mediumListBegin; 4515 it != mediumListEnd; 4516 ++it) 4517 { 4518 const MediumLock &mediumLock = *it; 4519 const ComObjPtr<Medium> &pMedium = mediumLock.GetMedium(); 4520 AutoWriteLock alock(pMedium COMMA_LOCKVAL_SRC_POS); 4521 4522 if (pMedium->m->state == MediumState_Deleting) 4523 { 4524 rc = pMedium->unmarkForDeletion(); 4525 AssertComRC(rc); 4526 } 4527 } 4509 4528 4510 4529 /* the destructor will do the work */ … … 5025 5044 MediumLockList::Base::const_iterator targetListEnd = 5026 5045 task.mpMediumLockList->GetEnd(); 5027 targetListEnd--;5028 5046 for (MediumLockList::Base::const_iterator it = targetListBegin; 5029 5047 it != targetListEnd; … … 5034 5052 5035 5053 AutoReadLock alock(pMedium COMMA_LOCKVAL_SRC_POS); 5054 5055 /* Skip over the target diff image */ 5056 if (pMedium->m->state == MediumState_Creating) 5057 continue; 5036 5058 5037 5059 /* sanity check */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器