Changeset 35602 in vbox for trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
- Timestamp:
- Jan 18, 2011 11:27:20 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r35368 r35602 346 346 STDMETHODIMP Snapshot::COMSETTER(Name)(IN_BSTR aName) 347 347 { 348 HRESULT rc = S_OK; 348 349 CheckComArgStrNotEmptyOrNull(aName); 349 350 … … 358 359 { 359 360 m->strName = strName; 360 361 361 alock.leave(); /* Important! (child->parent locks are forbidden) */ 362 363 // flag the machine as dirty or change won't get saved 364 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 365 m->pMachine->setModified(Machine::IsModified_Snapshots); 366 mlock.leave(); 367 368 return m->pMachine->onSnapshotChange(this); 369 } 370 371 return S_OK; 362 rc = m->pMachine->onSnapshotChange(this); 363 } 364 365 return rc; 372 366 } 373 367 … … 387 381 STDMETHODIMP Snapshot::COMSETTER(Description)(IN_BSTR aDescription) 388 382 { 383 HRESULT rc = S_OK; 389 384 AutoCaller autoCaller(this); 390 385 if (FAILED(autoCaller.rc())) return autoCaller.rc(); … … 397 392 { 398 393 m->strDescription = strDescription; 399 400 394 alock.leave(); /* Important! (child->parent locks are forbidden) */ 401 402 // flag the machine as dirty or change won't get saved 403 AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); 404 m->pMachine->setModified(Machine::IsModified_Snapshots); 405 mlock.leave(); 406 407 return m->pMachine->onSnapshotChange(this); 408 } 409 410 return S_OK; 395 rc = m->pMachine->onSnapshotChange(this); 396 } 397 398 return rc; 411 399 } 412 400 … … 1193 1181 * snapshot data such as name or description is changed. 1194 1182 * 1195 * @ note Locks this object for writing.1183 * @warning Caller must hold no locks when calling this. 1196 1184 */ 1197 1185 HRESULT SnapshotMachine::onSnapshotChange(Snapshot *aSnapshot) 1198 1186 { 1199 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1200 1201 // mPeer->saveAllSnapshots(); @todo 1187 AutoMultiWriteLock2 mlock(this, aSnapshot COMMA_LOCKVAL_SRC_POS); 1188 Guid uuidMachine(mData->mUuid), 1189 uuidSnapshot(aSnapshot->getId()); 1190 bool fNeedsGlobalSaveSettings = false; 1191 1192 // flag the machine as dirty or change won't get saved 1193 mPeer->setModified(Machine::IsModified_Snapshots); 1194 HRESULT rc = mPeer->saveSettings(&fNeedsGlobalSaveSettings, 1195 SaveS_Force); // we know we need saving, no need to check 1196 mlock.leave(); 1197 1198 if (SUCCEEDED(rc) && fNeedsGlobalSaveSettings) 1199 { 1200 // save the global settings 1201 AutoWriteLock vboxlock(mParent COMMA_LOCKVAL_SRC_POS); 1202 rc = mParent->saveSettings(); 1203 } 1202 1204 1203 1205 /* inform callbacks */ 1204 mParent->onSnapshotChange( mData->mUuid, aSnapshot->getId());1205 1206 return S_OK;1206 mParent->onSnapshotChange(uuidMachine, uuidSnapshot); 1207 1208 return rc; 1207 1209 } 1208 1210
Note:
See TracChangeset
for help on using the changeset viewer.