VirtualBox

Ignore:
Timestamp:
Oct 20, 2009 4:31:36 PM (15 years ago)
Author:
vboxsync
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/include/MediumAttachmentImpl.h

    r23880 r23914  
    5454    HRESULT init(Machine *aParent,
    5555                 Medium *aMedium,
    56                  StorageController *aController,
     56                 const Bstr &aControllerName,
    5757                 LONG aPort,
    5858                 LONG aDevice,
     
    8383
    8484    const ComObjPtr<Medium> &medium() const { return m->medium; }
    85     const ComObjPtr<StorageController> &controller() const { return m->controller; }
     85    Bstr controllerName() const { return m->controllerName; }
    8686    LONG port() const { return m->port; }
    8787    LONG device() const { return m->device; }
     
    8989    bool passthrough() const { AutoReadLock lock(this); return m->passthrough; }
    9090
    91     bool matches(CBSTR aController, LONG aPort, LONG aDevice)
     91    bool matches(CBSTR aControllerName, LONG aPort, LONG aDevice)
    9292    {
    93         return (    aController == m->controller->name()
     93        return (    aControllerName == m->controllerName
    9494                 && aPort == m->port
    9595                 && aDevice == m->device);
     
    125125
    126126        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;
    128133        const LONG port;
    129134        const LONG device;
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