VirtualBox

Changeset 42123 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Jul 12, 2012 10:10:36 AM (13 years ago)
Author:
vboxsync
Message:

Main/Machine+Snapshot: fix crash on snapshot restore due to incorrect saving of settings (#6281)

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

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

    r42022 r42123  
    1318713187 *
    1318813188 * @note Locks this object for writing.
     13189 * @note This method must not call saveSettings or SaveSettings, otherwise
     13190 *       it can cause crashes in random places due to unexpectedly committing
     13191 *       the current settings. The caller is responsible for that. The call
     13192 *       to saveStateSettings is fine, because this method does not commit.
    1318913193 */
    1319013194HRESULT SessionMachine::setMachineState(MachineState_T aMachineState)
     
    1338513389            mData->mCurrentStateModified = TRUE;
    1338613390            stsFlags |= SaveSTS_CurStateModified;
    13387             SaveSettings();     // @todo r=dj why the public method? why first SaveSettings and then saveStateSettings?
    1338813391        }
    1338913392    }
  • trunk/src/VBox/Main/src-server/SnapshotImpl.cpp

    r42110 r42123  
    19051905        stateRestored = true;
    19061906
     1907        /* Paranoia: no one must have saved the settings in the mean time. If
     1908         * it happens nevertheless we'll close our eyes and continue below. */
     1909        Assert(mMediaData.isBackedUp());
     1910
    19071911        /* assign the timestamp from the snapshot */
    1908         Assert(RTTimeSpecGetMilli (&snapshotTimeStamp) != 0);
     1912        Assert(RTTimeSpecGetMilli(&snapshotTimeStamp) != 0);
    19091913        mData->mLastStateChange = snapshotTimeStamp;
    19101914
     
    19321936            // remove from machine data
    19331937            mMediaData->mAttachments.remove(pAttach);
    1934             // remove it from the backup or else saveSettings will try to detach
    1935             // it again and assert
    1936             mMediaData.backedUpData()->mAttachments.remove(pAttach);
     1938            // Remove it from the backup or else saveSettings will try to detach
     1939            // it again and assert. The paranoia check avoids crashes (see
     1940            // assert above) if this code is buggy and saves settings in the
     1941            // wrong place.
     1942            if (mMediaData.isBackedUp())
     1943                mMediaData.backedUpData()->mAttachments.remove(pAttach);
    19371944            // then clean up backrefs
    19381945            pMedium->removeBackReference(mData->mUuid);
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