Changeset 23914 in vbox
- Timestamp:
- Oct 20, 2009 4:31:36 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53716
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r23911 r23914 309 309 while (thatIt != thatAtts.end()) 310 310 { 311 if ((*it)-> controller() == (*thatIt)->controller() &&312 (*it)->port() == (*thatIt)->port() &&313 (*it)->device() == (*thatIt)->device() &&311 if ((*it)->matches((*thatIt)->controllerName(), 312 (*thatIt)->port(), 313 (*thatIt)->device()) && 314 314 (*it)->passthrough() == (*thatIt)->passthrough() && 315 315 (*it)->medium().equalsTo ((*thatIt)->medium())) … … 2433 2433 ComObjPtr<MediumAttachment> attachment; 2434 2434 attachment.createObject(); 2435 rc = attachment->init(this, medium, ctl, aControllerPort, aDevice, aType, indirect);2435 rc = attachment->init(this, medium, aControllerName, aControllerPort, aDevice, aType, indirect); 2436 2436 CheckComRCReturnRC(rc); 2437 2437 … … 3558 3558 ++it) 3559 3559 { 3560 if (Bstr((*it)->controller ()->name()) == aName)3560 if (Bstr((*it)->controllerName()) == aName) 3561 3561 return setError(VBOX_E_OBJECT_IN_USE, 3562 3562 tr("Storage controller named '%ls' has still devices attached"), … … 5608 5608 rc = pAttachment->init(this, 5609 5609 medium, 5610 aStorageController ,5610 aStorageController->name(), 5611 5611 dev.lPort, 5612 5612 dev.lDevice, … … 5751 5751 ++it) 5752 5752 { 5753 if (Bstr((*it)->controller ()->name()) == aName)5753 if (Bstr((*it)->controllerName()) == aName) 5754 5754 atts.push_back(*it); 5755 5755 } … … 6642 6642 rc = attachment->init(this, 6643 6643 diff, 6644 pAtt->controller (),6644 pAtt->controllerName(), 6645 6645 pAtt->port(), 6646 6646 pAtt->device(), -
trunk/src/VBox/Main/MediumAttachmentImpl.cpp
r23880 r23914 58 58 HRESULT MediumAttachment::init(Machine *aParent, 59 59 Medium *aMedium, 60 StorageController *aController,60 const Bstr &aControllerName, 61 61 LONG aPort, 62 62 LONG aDevice, … … 65 65 { 66 66 LogFlowThisFuncEnter(); 67 LogFlowThisFunc(("aParent=%p aMedium=%p aController =%ls aPort=%d aDevice=%d aType=%d aImplicit=%d\n", aParent, aMedium, aController, aPort, aDevice, aType, aImplicit));67 LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=%ls aPort=%d aDevice=%d aType=%d aImplicit=%d\n", aParent, aMedium, aControllerName.raw(), aPort, aDevice, aType, aImplicit)); 68 68 69 69 if (aType == DeviceType_HardDisk) … … 78 78 m.allocate(); 79 79 m->medium = aMedium; 80 unconst(m->controller ) = aController;80 unconst(m->controllerName) = aControllerName; 81 81 unconst(m->port) = aPort; 82 82 unconst(m->device) = aDevice; … … 190 190 191 191 /* m->controller is constant during life time, no need to lock */ 192 m->controller.queryInterfaceTo(aController); 193 194 LogFlowThisFuncLeave(); 195 return S_OK; 192 /** @todo ugly hack, MediumAttachment should have a direct reference 193 * to the storage controller, but can't have that right now due to 194 * how objects are created for settings rollback support. */ 195 HRESULT rc = mParent->GetStorageControllerByName(m->controllerName, aController); 196 197 LogFlowThisFuncLeave(); 198 return rc; 196 199 } 197 200 -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r23880 r23914 54 54 HRESULT init(Machine *aParent, 55 55 Medium *aMedium, 56 StorageController *aController,56 const Bstr &aControllerName, 57 57 LONG aPort, 58 58 LONG aDevice, … … 83 83 84 84 const ComObjPtr<Medium> &medium() const { return m->medium; } 85 const ComObjPtr<StorageController> &controller() const { return m->controller; }85 Bstr controllerName() const { return m->controllerName; } 86 86 LONG port() const { return m->port; } 87 87 LONG device() const { return m->device; } … … 89 89 bool passthrough() const { AutoReadLock lock(this); return m->passthrough; } 90 90 91 bool matches(CBSTR aController , LONG aPort, LONG aDevice)91 bool matches(CBSTR aControllerName, LONG aPort, LONG aDevice) 92 92 { 93 return ( aController == m->controller->name()93 return ( aControllerName == m->controllerName 94 94 && aPort == m->port 95 95 && aDevice == m->device); … … 125 125 126 126 ComObjPtr<Medium> medium; 127 ComObjPtr<StorageController> controller; 127 /* Since MediumAttachment is not a first class citizen when it 128 * comes to managing settings, having a reference to the storage 129 * controller will not work - when settings are changed it will point 130 * to the old, uninitialized instance. Changing this requires 131 * substantial changes to MediumImpl.cpp. */ 132 Bstr controllerName; 128 133 const LONG port; 129 134 const LONG device;
Note:
See TracChangeset
for help on using the changeset viewer.