- Timestamp:
- Mar 24, 2009 3:04:37 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 44910
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/DVDDriveImpl.cpp
r17238 r18194 590 590 591 591 m.rollback(); 592 if (!m->image.isNull()) 593 { 594 /* Reattach from the old image. */ 595 HRESULT rc = m->image->attachTo(mParent->id(), mParent->snapshotId()); 596 AssertComRC (rc); 597 if (Global::IsOnline (adep.machineState())) 598 { 599 /* Lock from the old image. */ 600 rc = m->image->LockRead (NULL); 601 AssertComRC (rc); 602 } 603 } 592 604 } 593 605 … … 609 621 AssertComRCReturnVoid (peerCaller.rc()); 610 622 611 /* we need adep for the state check */612 Machine::AutoAnyStateDependency adep (mParent);613 AssertComRCReturnVoid (adep.rc());614 615 623 /* lock both for writing since we modify both (mPeer is "master" so locked 616 624 * first) */ … … 619 627 if (m.isBackedUp()) 620 628 { 621 Data *oldData = m.backedUpData();622 623 if (!oldData->image.isNull() &&624 !oldData->image.equalsTo (m->image))625 {626 /* detach the old image that will go away after commit */627 oldData->image->detachFrom (mParent->id(), mParent->snapshotId());628 629 /* unlock the image for reading if the VM is online */630 if (Global::IsOnline (adep.machineState()))631 {632 HRESULT rc = oldData->image->UnlockRead (NULL);633 AssertComRC (rc);634 }635 }636 637 629 m.commit(); 638 630 if (mPeer) … … 676 668 { 677 669 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 670 671 /* we need adep for the state check */ 672 Machine::AutoAnyStateDependency adep (mParent); 673 AssertComRCReturn (adep.rc(), false); 674 675 if (!m->image.isNull()) 676 { 677 HRESULT rc = m->image->detachFrom (mParent->id(), mParent->snapshotId()); 678 AssertComRC (rc); 679 if (Global::IsOnline (adep.machineState())) 680 { 681 rc = m->image->UnlockRead (NULL); 682 AssertComRC (rc); 683 } 684 } 678 685 679 686 m.backup(); -
trunk/src/VBox/Main/FloppyDriveImpl.cpp
r17255 r18194 597 597 598 598 m.rollback(); 599 if (!m->image.isNull()) 600 { 601 /* Reattach from the old image. */ 602 HRESULT rc = m->image->attachTo(mParent->id(), mParent->snapshotId()); 603 AssertComRC (rc); 604 if (Global::IsOnline (adep.machineState())) 605 { 606 /* Lock from the old image. */ 607 rc = m->image->LockRead (NULL); 608 AssertComRC (rc); 609 } 610 } 599 611 } 600 612 … … 616 628 AssertComRCReturnVoid (peerCaller.rc()); 617 629 618 /* we need adep for the state check */619 Machine::AutoAnyStateDependency adep (mParent);620 AssertComRCReturnVoid (adep.rc());621 622 630 /* lock both for writing since we modify both (mPeer is "master" so locked 623 631 * first) */ … … 626 634 if (m.isBackedUp()) 627 635 { 628 Data *oldData = m.backedUpData();629 630 if (!oldData->image.isNull() &&631 !oldData->image.equalsTo (m->image))632 {633 /* detach the old image that will go away after commit */634 oldData->image->detachFrom (mParent->id(), mParent->snapshotId());635 636 /* unlock the image for reading if the VM is online */637 if (Global::IsOnline (adep.machineState()))638 {639 HRESULT rc = oldData->image->UnlockRead (NULL);640 AssertComRC (rc);641 }642 }643 644 636 m.commit(); 645 637 if (mPeer) … … 681 673 { 682 674 AssertReturn (isWriteLockOnCurrentThread(), E_FAIL); 675 676 /* we need adep for the state check */ 677 Machine::AutoAnyStateDependency adep (mParent); 678 AssertComRCReturn (adep.rc(), false); 679 680 if (!m->image.isNull()) 681 { 682 HRESULT rc = m->image->detachFrom (mParent->id(), mParent->snapshotId()); 683 AssertComRC (rc); 684 if (Global::IsOnline (adep.machineState())) 685 { 686 rc = m->image->UnlockRead (NULL); 687 AssertComRC (rc); 688 } 689 } 683 690 684 691 m.backup();
Note:
See TracChangeset
for help on using the changeset viewer.