VirtualBox

Changeset 36181 in vbox for trunk/src


Ignore:
Timestamp:
Mar 7, 2011 10:17:33 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
70383
Message:

Main: Fix crashes when starting a VM with a bandwidth group caused by a stale parent machine pointer

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/MediumAttachmentImpl.h

    r36058 r36181  
    9191    void updateBandwidthGroup(const Utf8Str &aBandwidthGroup);
    9292
     93    void updateParentMachine(Machine * const pMachine);
     94
    9395    /** Get a unique and somewhat descriptive name for logging. */
    9496    const char* getLogName(void) const { return mLogName.c_str(); }
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r36178 r36181  
    95919591    if (isSessionMachine())
    95929592    {
     9593        /*
     9594         * Update the parent machine to point to the new owner.
     9595         * This is necessary because the stored parent will point to the
     9596         * session machine otherwise and cause crashes or errors later
     9597         * when the session machine gets invalid.
     9598         *
     9599         * @todo: Change the MediumAttachment class to behave like any other class
     9600         *        in this regard by creating peer MediumAttachment objects for
     9601         *        session machines and share the data with the peer machine.
     9602         */
     9603        for (MediaData::AttachmentList::const_iterator it = mMediaData->mAttachments.begin();
     9604             it != mMediaData->mAttachments.end();
     9605             ++it)
     9606        {
     9607            (*it)->updateParentMachine(mPeer);
     9608        }
     9609
    95939610        /* attach new data to the primary machine and reshare it */
    95949611        mPeer->mMediaData.attach(mMediaData);
  • trunk/src/VBox/Main/src-server/MediumAttachmentImpl.cpp

    r36059 r36181  
    281281STDMETHODIMP MediumAttachment::COMGETTER(BandwidthGroup) (IBandwidthGroup **aBwGroup)
    282282{
     283    LogFlowThisFuncEnter();
    283284    CheckComArgOutPointerValid(aBwGroup);
    284285
     
    300301    }
    301302
     303    LogFlowThisFuncLeave();
    302304    return hrc;
    303305}
     
    426428}
    427429
     430void MediumAttachment::updateParentMachine(Machine * const pMachine)
     431{
     432    LogFlowThisFunc(("ENTER - %s\n", getLogName()));
     433
     434    /* sanity */
     435    AutoCaller autoCaller(this);
     436    AssertComRCReturnVoid (autoCaller.rc());
     437
     438    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     439
     440    unconst(m->pMachine) = pMachine;
     441
     442    LogFlowThisFunc(("LEAVE - %s\n", getLogName()));
     443}
     444
Note: See TracChangeset for help on using the changeset viewer.

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