Changeset 24691 in vbox for trunk/src/VBox/Main
- Timestamp:
- Nov 16, 2009 12:46:23 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MediumImpl.cpp
r24563 r24691 614 614 */ 615 615 class Medium::ImageChain : public Medium::List, 616 616 public com::SupportErrorInfoBase 617 617 { 618 618 public: … … 671 671 { 672 672 HRESULT rc = S_OK; 673 MediumState_T medi aState;674 rc = (*it)->LockRead(&mediaState); 675 CheckComRCReturnRC(rc);676 677 if (medi aState == MediumState_Inaccessible)673 MediumState_T mediumState = (*it)->state(); 674 675 /* accessibility check must be first, otherwise locking 676 * interferes with getting the medium state. */ 677 if (mediumState == MediumState_Inaccessible) 678 678 { 679 rc = (*it)->RefreshState(&medi aState);679 rc = (*it)->RefreshState(&mediumState); 680 680 CheckComRCReturnRC(rc); 681 Assert(mediaState == MediumState_LockedRead); 682 683 /* Note that we locked the medium already, so use the error 684 * value to see if there was an accessibility failure */ 685 Bstr error; 686 rc = (*it)->COMGETTER(LastAccessError)(error.asOutParam()); 687 CheckComRCReturnRC(rc); 688 689 if (!error.isEmpty()) 681 682 if (mediumState == MediumState_Inaccessible) 690 683 { 684 Bstr error; 685 rc = (*it)->COMGETTER(LastAccessError)(error.asOutParam()); 686 CheckComRCReturnRC(rc); 687 691 688 Bstr loc; 692 689 rc = (*it)->COMGETTER(Location)(loc.asOutParam()); 693 CheckComRC ThrowRC(rc);690 CheckComRCReturnRC(rc); 694 691 695 692 /* collect multiple errors */ … … 705 702 } 706 703 } 704 705 rc = (*it)->LockRead(&mediumState); 706 CheckComRCReturnRC(rc); 707 707 } 708 708 … … 725 725 { 726 726 HRESULT rc = S_OK; 727 MediumState_T mediaState; 728 if (it == last) 729 rc = (*it)->LockWrite(&mediaState); 730 else 731 rc = (*it)->LockRead(&mediaState); 732 CheckComRCReturnRC(rc); 733 734 if (mediaState == MediumState_Inaccessible) 727 MediumState_T mediumState = (*it)->state(); 728 729 /* accessibility check must be first, otherwise locking 730 * interferes with getting the medium state. */ 731 if (mediumState == MediumState_Inaccessible) 735 732 { 736 rc = (*it)->RefreshState(&medi aState);733 rc = (*it)->RefreshState(&mediumState); 737 734 CheckComRCReturnRC(rc); 738 if (it == last) 739 Assert(mediaState == MediumState_LockedWrite); 740 else 741 Assert(mediaState == MediumState_LockedRead); 742 743 /* Note that we locked the medium already, so use the error 744 * value to see if there was an accessibility failure */ 745 Bstr error; 746 rc = (*it)->COMGETTER(LastAccessError)(error.asOutParam()); 747 CheckComRCReturnRC(rc); 748 749 if (!error.isEmpty()) 735 736 if (mediumState == MediumState_Inaccessible) 750 737 { 738 Bstr error; 739 rc = (*it)->COMGETTER(LastAccessError)(error.asOutParam()); 740 CheckComRCReturnRC(rc); 741 751 742 Bstr loc; 752 743 rc = (*it)->COMGETTER(Location)(loc.asOutParam()); 753 CheckComRC ThrowRC(rc);744 CheckComRCReturnRC(rc); 754 745 755 746 /* collect multiple errors */ … … 765 756 } 766 757 } 758 759 if (it == last) 760 rc = (*it)->LockWrite(&mediumState); 761 else 762 rc = (*it)->LockRead(&mediumState); 767 763 } 768 764
Note:
See TracChangeset
for help on using the changeset viewer.