VirtualBox

Changeset 40276 in vbox


Ignore:
Timestamp:
Feb 28, 2012 1:50:09 PM (13 years ago)
Author:
vboxsync
Message:

Main/Console: fix deadlock when a VM triggers saving its own state, regression from locking cleanup

File:
1 edited

Legend:

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

    r40257 r40276  
    26292629    if (mMachineState == MachineState_Running)
    26302630    {
    2631         HRESULT rc = Pause();
    2632         if (FAILED(rc))
    2633             return rc;
     2631        /* get the VM handle. */
     2632        SafeVMPtr ptrVM(this);
     2633        if (!ptrVM.isOk())
     2634            return ptrVM.rc();
     2635
     2636        /* release the lock before a VMR3* call (EMT will call us back)! */
     2637        alock.release();
     2638        int vrc = VMR3Suspend(ptrVM);
     2639        alock.acquire();
     2640
     2641        HRESULT hrc = S_OK;
     2642        if (RT_FAILURE(vrc))
     2643            hrc = setError(VBOX_E_VM_ERROR, tr("Could not suspend the machine execution (%Rrc)"), vrc);
     2644        if (FAILED(hrc))
     2645            return hrc;
    26342646    }
    26352647
     
    27272739            setMachineStateLocally(MachineState_Paused);
    27282740            /* restore the running state if appropriate */
    2729             Resume();
     2741            SafeVMPtr ptrVM(this);
     2742            if (ptrVM.isOk())
     2743            {
     2744                alock.release();
     2745                VMR3Resume(ptrVM);
     2746                alock.acquire();
     2747            }
    27302748        }
    27312749        else
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