Changeset 49502 in vbox
- Timestamp:
- Nov 15, 2013 1:11:13 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r49439 r49502 63 63 using namespace com; 64 64 65 /** Set by the signal handler. */ 66 static volatile bool g_fGuestCtrlCanceled = false; 67 /** Our global session object which is also used in the 68 * signal handler to abort operations properly. */ 69 static ComPtr<IGuestSession> g_pGuestSession = NULL; 65 /** Set by the signal handler when current guest control 66 * action shall be aborted. */ 67 static volatile bool g_fGuestCtrlCanceled = false; 70 68 71 69 /** … … 403 401 case CTRL_C_EVENT: 404 402 ASMAtomicWriteBool(&g_fGuestCtrlCanceled, true); 405 if (!g_pGuestSession.isNull())406 g_pGuestSession->Close();407 403 fEventHandled = TRUE; 408 404 break; … … 419 415 * 420 416 * This can be executed on any thread in the process, on Windows it may even be 421 * a thread dedicated to delivering this signal. Do not doinganything417 * a thread dedicated to delivering this signal. Don't do anything 422 418 * unnecessary here. 423 419 */ … … 426 422 NOREF(iSignal); 427 423 ASMAtomicWriteBool(&g_fGuestCtrlCanceled, true); 428 if (!g_pGuestSession.isNull())429 g_pGuestSession->Close();430 424 } 431 425 #endif … … 727 721 && pCtx->fVerbose) 728 722 RTPrintf("Guest session detached\n"); 729 723 #ifdef DEBUG 724 ULONG cRefs = pCtx->pGuestSession->AddRef(); 725 RTPrintf("cRefs=%RU32\n", cRefs - 1); 726 pCtx->pGuestSession->Release(); 727 #endif 730 728 pCtx->pGuestSession.setNull(); 731 729 } 732 730 733 g_pGuestSession.setNull();734 731 if (pCtx->handlerArg.session) 735 732 CHECK_ERROR(pCtx->handlerArg.session, UnlockMachine()); … … 992 989 && !(uFlags & CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER)) 993 990 { 994 /* Add session to global for being accessible by the995 * signal handler. */996 g_pGuestSession = pCtx->pGuestSession;997 998 991 ctrlSignalHandlerInstall(); 999 992 } … … 1341 1334 cMsTimeLeft = ctrlExecGetRemainingTime(u64StartMS, cMsTimeout); 1342 1335 CHECK_ERROR_BREAK(pProcess, WaitForArray(ComSafeArrayAsInParam(aWaitFlags), 1343 cMsTimeLeft, &waitResult));1336 500 /* ms */, &waitResult)); 1344 1337 switch (waitResult) 1345 1338 { … … 1374 1367 break; 1375 1368 } 1369 case ProcessWaitResult_Timeout: 1370 /* Fall through is intentional. */ 1376 1371 default: 1377 1372 /* Ignore all other results, let the timeout expire */ … … 1467 1462 */ 1468 1463 fCloseSession = !fDetached; 1464 1465 /* 1466 * If execution was aborted from the host side (signal handler), 1467 * close the guest session in any case. 1468 */ 1469 if (g_fGuestCtrlCanceled) 1470 fCloseSession = true; 1469 1471 } 1470 1472 else /* Close session on error. */ … … 3726 3728 HRESULT rc = S_OK; 3727 3729 3728 ComPtr<IGuestSession> pSession;3729 3730 do 3730 3731 { … … 3738 3739 for (size_t i = 0; i < cSessions; i++) 3739 3740 { 3740 pSession = collSessions[i];3741 ComPtr<IGuestSession> pSession = collSessions[i]; 3741 3742 Assert(!pSession.isNull()); 3742 3743 … … 3769 3770 RTPrintf("Guest session successfully closed\n"); 3770 3771 3771 pSession ->Release();3772 pSession.setNull(); 3772 3773 } 3773 3774 }
Note:
See TracChangeset
for help on using the changeset viewer.