VirtualBox

Ignore:
Timestamp:
Oct 20, 2009 4:31:36 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53716
Message:

Main/MediumAttachment: very ugly fix for the fact that MediumAttachment instances can't have references to StorageController objects, because the reference would be invalid after changed settings are saved.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MediumAttachmentImpl.cpp

    r23880 r23914  
    5858HRESULT MediumAttachment::init(Machine *aParent,
    5959                               Medium *aMedium,
    60                                StorageController *aController,
     60                               const Bstr &aControllerName,
    6161                               LONG aPort,
    6262                               LONG aDevice,
     
    6565{
    6666    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));
    6868
    6969    if (aType == DeviceType_HardDisk)
     
    7878    m.allocate();
    7979    m->medium = aMedium;
    80     unconst(m->controller) = aController;
     80    unconst(m->controllerName) = aControllerName;
    8181    unconst(m->port)   = aPort;
    8282    unconst(m->device) = aDevice;
     
    190190
    191191    /* 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;
    196199}
    197200
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette