VirtualBox

Changeset 44490 in vbox for trunk/src


Ignore:
Timestamp:
Jan 31, 2013 1:28:16 PM (12 years ago)
Author:
vboxsync
Message:

Main/Machine: avoid triggering spurious MachineStateChanged events for loading broken VM configs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r44274 r44490  
    1040810408    AssertReturn(mMediaData.isBackedUp(), E_FAIL);
    1040910409
     10410    /* Check if there are any implicitly created diff images. */
     10411    bool fImplicitDiffs = false;
     10412    for (MediaData::AttachmentList::const_iterator it = mMediaData->mAttachments.begin();
     10413         it != mMediaData->mAttachments.end();
     10414         ++it)
     10415    {
     10416        const ComObjPtr<MediumAttachment> &pAtt = *it;
     10417        if (pAtt->isImplicit())
     10418        {
     10419            fImplicitDiffs = true;
     10420            break;
     10421        }
     10422    }
     10423    /* If there is nothing to do, leave early. This saves lots of image locking
     10424     * effort. It also avoids a MachineStateChanged event without real reason.
     10425     * This is important e.g. when loading a VM config, because there should be
     10426     * no events. Otherwise API clients can become thoroughly confused for
     10427     * inaccessible VMs (the code for loading VM configs uses this method for
     10428     * cleanup if the config makes no sense), as they take such events as an
     10429     * indication that the VM is alive, and they would force the VM config to
     10430     * be reread, leading to an endless loop. */
     10431    if (!fImplicitDiffs)
     10432        return S_OK;
     10433
    1041010434    HRESULT rc = S_OK;
    1041110435    MachineState_T oldState = mData->mMachineState;
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