- Timestamp:
- Dec 8, 2023 10:15:02 AM (17 months ago)
- svn:sync-xref-src-repo-rev:
- 160677
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/Main/include/GuestImpl.h ¶
r98103 r102533 131 131 int i_sessionCreate(const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds, 132 132 ComObjPtr<GuestSession> &pGuestSession); 133 int i_session Destroy(uint32_t uSessionID);133 int i_sessionRemove(uint32_t uSessionID); 134 134 inline bool i_sessionExists(uint32_t uSessionID); 135 135 /** Returns the VBOX_GUESTCTRL_GF_0_XXX mask reported by the guest. */ -
TabularUnified trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp ¶
r99416 r102533 350 350 351 351 /** 352 * Destroys a given guest session and removes it from the internal list.352 * Removes a given guest session and removes it from the internal list. 353 353 * 354 354 * @returns VBox status code. 355 355 * @param uSessionID ID of the guest control session to destroy. 356 356 * 357 * @note Takes the write lock.357 * @note Takes the read + write locks. 358 358 */ 359 int Guest::i_session Destroy(uint32_t uSessionID)359 int Guest::i_sessionRemove(uint32_t uSessionID) 360 360 { 361 361 LogFlowThisFuncEnter(); 362 362 363 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);364 365 363 int vrc = VERR_NOT_FOUND; 366 364 367 LogFlowThisFunc(("Destroying session (ID=%RU32) ...\n", uSessionID)); 365 LogFlowThisFunc(("Removing session (ID=%RU32) ...\n", uSessionID)); 366 367 AutoReadLock arlock(this COMMA_LOCKVAL_SRC_POS); 368 368 369 369 GuestSessions::iterator itSessions = mData.mGuestSessions.find(uSessionID); … … 379 379 380 380 vrc = pSession->i_onRemove(); 381 382 arlock.release(); 383 384 AutoWriteLock awlock(this COMMA_LOCKVAL_SRC_POS); 381 385 mData.mGuestSessions.erase(itSessions); 382 383 alock.release(); /* Release lock before firing off event. */ 386 awlock.release(); /* Release write lock before firing off event. */ 384 387 385 388 ::FireGuestSessionRegisteredEvent(mEventSource, pSession, false /* Unregistered */); -
TabularUnified trunk/src/VBox/Main/src-client/GuestImpl.cpp ¶
r99739 r102533 188 188 { 189 189 # ifdef DEBUG 190 /** @todo r=bird: hit a use-after-free situation here while debugging the191 * 0xcccccccc status code issue in copyto. My bet is that this happens192 * because of an uninit race, where GuestSession::close(), or someone, does193 * not ensure that the parent object (Guest) is okay to use (in the AutoCaller194 * sense), only their own object. */195 190 ULONG cRefs = itSessions->second->AddRef(); 196 191 LogFlowThisFunc(("sessionID=%RU32, cRefs=%RU32\n", itSessions->first, cRefs > 1 ? cRefs - 1 : 0)); -
TabularUnified trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp ¶
r100325 r102533 320 320 void GuestSession::uninit(void) 321 321 { 322 LogFlowThisFuncEnter(); 323 322 324 /* Enclose the state transition Ready->InUninit->NotReady. */ 323 325 AutoUninitSpan autoUninitSpan(this); 324 326 if (autoUninitSpan.uninitDone()) 325 327 return; 326 327 LogFlowThisFuncEnter();328 328 329 329 /* Call i_onRemove to take care of the object cleanups. */ … … 3374 3374 3375 3375 #ifndef VBOX_GUESTCTRL_TEST_CASE 3376 AutoCaller autoCallerParent(mParent); 3377 if (FAILED(autoCallerParent.hrc())) 3378 return VERR_STATE_CHANGED; 3379 3376 3380 ComObjPtr<Console> pConsole = mParent->i_getConsole(); 3377 3381 Assert(!pConsole.isNull()); … … 3379 3383 /* Forward the information to the VMM device. */ 3380 3384 VMMDev *pVMMDev = pConsole->i_getVMMDev(); 3381 AssertPtrReturn(pVMMDev, VERR_STATE_CHANGED); 3385 if (!pVMMDev) 3386 return VERR_STATE_CHANGED; 3382 3387 3383 3388 LogFlowThisFunc(("uMessage=%RU32 (%s), uParms=%RU32\n", uMessage, GstCtrlHostMsgtoStr((guestControl::eHostMsg)uMessage), uParms)); … … 3851 3856 HRESULT GuestSession::close() 3852 3857 { 3858 AutoCaller autoCaller(this); 3859 if (FAILED(autoCaller.hrc())) return autoCaller.hrc(); 3860 3853 3861 LogFlowThisFuncEnter(); 3854 3862 … … 3879 3887 * work first and then return an error. */ 3880 3888 3881 /* Destroy session + remove ourselves from the session list. */ 3882 AssertPtr(mParent); 3883 int vrc2 = mParent->i_sessionDestroy(mData.mSession.mID); 3884 if (vrc2 == VERR_NOT_FOUND) /* Not finding the session anymore isn't critical. */ 3885 vrc2 = VINF_SUCCESS; 3886 3887 if (RT_SUCCESS(vrc)) 3888 vrc = vrc2; 3889 /* We have to make sure that our parent (IGuest) still is alive and in a working shapee. 3890 * If not, skip removing the session from it. */ 3891 AutoCaller autoCallerParent(mParent); 3892 if (SUCCEEDED(autoCallerParent.hrc())) 3893 { 3894 LogFlowThisFunc(("Removing session '%s' from parent ...", mData.mSession.mName.c_str())); 3895 3896 /* Remove ourselves from the session list. */ 3897 AssertPtr(mParent); 3898 int vrc2 = mParent->i_sessionRemove(mData.mSession.mID); 3899 if (vrc2 == VERR_NOT_FOUND) /* Not finding the session anymore isn't critical. */ 3900 vrc2 = VINF_SUCCESS; 3901 3902 if (RT_SUCCESS(vrc)) 3903 vrc = vrc2; 3904 } 3905 else /* Do the session remove stuff ourselves. */ 3906 vrc = i_onRemove(); 3889 3907 3890 3908 LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, vrcGuest));
Note:
See TracChangeset
for help on using the changeset viewer.