VirtualBox

Changeset 24937 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Nov 25, 2009 10:58:13 AM (15 years ago)
Author:
vboxsync
Message:

ConsoleImpl.cpp: Made live snapshots cancellable (missing and it simplifies testing).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r24922 r24937  
    26202620    rc = pProgress->init(static_cast<IConsole*>(this),
    26212621                         Bstr(tr("Taking a snapshot of the virtual machine")),
    2622                          FALSE /* aCancelable */,
     2622                         mMachineState == MachineState_Running /* aCancelable */,
    26232623                         cOperations,
    26242624                         ulTotalOperationsWeight,
     
    58475847                    break;
    58485848
    5849                 /* Change the machine state from Starting, Restoring or Paused
    5850                  * to Running */
    58515849                Assert(   (   (   that->mMachineState == MachineState_Starting
    58525850                               || that->mMachineState == MachineState_Paused)
     
    58545852                       || (   (   that->mMachineState == MachineState_Restoring
    58555853                               || that->mMachineState == MachineState_TeleportingIn
    5856                                || that->mMachineState == MachineState_Paused)
     5854                               || that->mMachineState == MachineState_Paused
     5855                               || that->mMachineState == MachineState_Saving
     5856                              )
    58575857                           && aOldState == VMSTATE_RESUMING));
    5858 
    58595858                that->setMachineState(MachineState_Running);
    58605859            }
     
    73307329
    73317330/**
     7331 * Progress cancelation callback employed by Console::fntTakeSnapshotWorker.
     7332 */
     7333static void takesnapshotProgressCancelCallback(void *pvUser)
     7334{
     7335    PVM pVM = (PVM)pvUser;
     7336    SSMR3Cancel(pVM);
     7337}
     7338
     7339/**
    73327340 * Worker thread created by Console::TakeSnapshot.
    73337341 * @param Thread The current thread (ignored).
     
    73997407            pTask->mProgress->SetNextOperation(Bstr(tr("Saving the machine state")),
    74007408                                               pTask->ulMemSize);       // operation weight, same as computed when setting up progress object
     7409            pTask->mProgress->setCancelCallback(takesnapshotProgressCancelCallback, that->mpVM);
    74017410
    74027411            alock.leave();
     
    74147423                               strSavedStateFile.c_str(), vrc);
    74157424
     7425            pTask->mProgress->setCancelCallback(NULL, NULL);
     7426            if (!pTask->mProgress->notifyPointOfNoReturn())
     7427                throw setError(E_FAIL, tr("Cancelled"));
    74167428
    74177429            // STEP 4: reattach hard disks
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