VirtualBox

Changeset 26232 in vbox


Ignore:
Timestamp:
Feb 4, 2010 1:35:01 PM (15 years ago)
Author:
vboxsync
Message:

Main: reordering of function calls in openExistingSession() to prevent a deadlock -- see xtracker 4633

File:
1 edited

Legend:

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

    r26200 r26232  
    50195019    ComAssertRet (!mData->mSession.mDirectControl.isNull(), E_FAIL);
    50205020
    5021     /*
    5022      *  Get the console from the direct session (note that we don't leave the
    5023      *  lock here because GetRemoteConsole must not call us back).
    5024      */
    5025     ComPtr<IConsole> console;
    5026     HRESULT rc = mData->mSession.mDirectControl->
    5027                      GetRemoteConsole (console.asOutParam());
    5028     if (FAILED(rc))
    5029     {
    5030         /* The failure may occur w/o any error info (from RPC), so provide one */
    5031         return setError(VBOX_E_VM_ERROR,
    5032                         tr("Failed to get a console object from the direct session (%Rrc)"),
    5033                         rc);
    5034     }
    5035 
    5036     ComAssertRet (!console.isNull(), E_FAIL);
    5037 
    5038     ComObjPtr<SessionMachine> sessionMachine = mData->mSession.mMachine;
    5039     AssertReturn(!sessionMachine.isNull(), E_FAIL);
     5021    // copy member variables before leaving lock
     5022    ComPtr<IInternalSessionControl> pDirectControl = mData->mSession.mDirectControl;
     5023    ComObjPtr<SessionMachine> pSessionMachine = mData->mSession.mMachine;
     5024    AssertReturn(!pSessionMachine.isNull(), E_FAIL);
    50405025
    50415026    /*
     
    50475032    alock.leave();
    50485033
     5034    // get the console from the direct session (this is a remote call)
     5035    ComPtr<IConsole> pConsole;
     5036    LogFlowThisFunc(("Calling GetRemoteConsole()...\n"));
     5037    HRESULT rc = pDirectControl->GetRemoteConsole(pConsole.asOutParam());
     5038    LogFlowThisFunc(("GetRemoteConsole() returned %08X\n", rc));
     5039    if (FAILED (rc))
     5040        /* The failure may occur w/o any error info (from RPC), so provide one */
     5041        return setError (VBOX_E_VM_ERROR,
     5042            tr ("Failed to get a console object from the direct session (%Rrc)"), rc);
     5043
     5044    ComAssertRet(!pConsole.isNull(), E_FAIL);
     5045
    50495046    /* attach the remote session to the machine */
    50505047    LogFlowThisFunc(("Calling AssignRemoteMachine()...\n"));
    5051     rc = aControl->AssignRemoteMachine (sessionMachine, console);
     5048    rc = aControl->AssignRemoteMachine(pSessionMachine, pConsole);
    50525049    LogFlowThisFunc(("AssignRemoteMachine() returned %08X\n", rc));
    50535050
     
    50715068
    50725069    /* store the control in the list */
    5073     mData->mSession.mRemoteControls.push_back (aControl);
     5070    mData->mSession.mRemoteControls.push_back(aControl);
    50745071
    50755072    LogFlowThisFuncLeave();
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