VirtualBox

Ignore:
Timestamp:
May 7, 2015 1:58:38 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100140
Message:

Main/Machine+Snapshot+Medium: Remove bogus assertion when locking a machine for shared access. Fix a race between querying medium information and deleting the medium, which was triggered by the GUI medium thread querying the same medium which restoring a snapshot wanted to delete (timing sensitive, happened most with poweroff/restore snapshot). Additionally move the machine state update for restoring a snapshot to the end, when the operation is pretty much done. For taking a snapshot, make sure that the corresponding event is signalled after the operation completed.

File:
1 edited

Legend:

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

    r55698 r55728  
    17961796    task.m_pProgress->i_notifyComplete(rc);
    17971797
     1798    if (SUCCEEDED(rc))
     1799        mParent->i_onSnapshotTaken(mData->mUuid,
     1800                                   task.m_pSnapshot->i_getId());
    17981801    LogFlowThisFuncLeave();
    17991802}
     
    18641867        /* associate old hard disks with the snapshot and do locking/unlocking*/
    18651868        i_commitMedia(task.m_fTakingSnapshotOnline);
    1866 
    1867         /* inform callbacks */
    1868         mParent->i_onSnapshotTaken(mData->mUuid,
    1869                                    task.m_pSnapshot->i_getId());
    18701869        alock.release();
    18711870    }
     
    20392038
    20402039    HRESULT rc = S_OK;
    2041 
    2042     bool stateRestored = false;
    20432040
    20442041    try
     
    21612158         * state accordingly no matter of the delete snapshot result */
    21622159        if (mSSData->strStateFilePath.isNotEmpty())
    2163             i_setMachineState(MachineState_Saved);
     2160            task.modifyBackedUpState(MachineState_Saved);
    21642161        else
    2165             i_setMachineState(MachineState_PoweredOff);
    2166 
    2167         stateRestored = true;
     2162            task.modifyBackedUpState(MachineState_PoweredOff);
    21682163
    21692164        /* Paranoia: no one must have saved the settings in the mean time. If
     
    22522247        i_rollback(false /* aNotify */);
    22532248
    2254         if (!stateRestored)
    2255         {
    2256             /* restore the machine state */
    2257             i_setMachineState(task.m_machineStateBackup);
    2258         }
    22592249    }
    22602250
    22612251    mParent->i_saveModifiedRegistries();
     2252
     2253    /* restore the machine state */
     2254    i_setMachineState(task.m_machineStateBackup);
    22622255
    22632256    /* set the result (this will try to fetch current error info on failure) */
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