Changeset 71634 in vbox for trunk/src/VBox/Main
- Timestamp:
- Apr 3, 2018 5:45:44 PM (7 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestImpl.h
r71406 r71634 105 105 #ifdef VBOX_WITH_GUEST_CONTROL 106 106 int i_dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb); 107 int i_sessionRemove( GuestSession *pSession);107 int i_sessionRemove(uint32_t uSessionID); 108 108 int i_sessionCreate(const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds, 109 109 ComObjPtr<GuestSession> &pGuestSession); -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r71560 r71634 224 224 } 225 225 226 int Guest::i_sessionRemove(GuestSession *pSession) 227 { 228 AssertPtrReturn(pSession, VERR_INVALID_POINTER); 229 226 int Guest::i_sessionRemove(uint32_t uSessionID) 227 { 230 228 LogFlowThisFuncEnter(); 231 229 … … 234 232 int rc = VERR_NOT_FOUND; 235 233 236 LogFlowThisFunc(("Removing session (ID=%RU32) ...\n", pSession->i_getId())); 237 238 GuestSessions::iterator itSessions = mData.mGuestSessions.begin(); 239 while (itSessions != mData.mGuestSessions.end()) 240 { 241 if (pSession == itSessions->second) 242 { 243 #ifdef DEBUG_andy 244 ULONG cRefs = pSession->AddRef(); 245 Assert(cRefs >= 2); 246 LogFlowThisFunc(("pCurSession=%p, cRefs=%RU32\n", pSession, cRefs - 2)); 247 pSession->Release(); 248 #endif 249 /* Make sure to consume the pointer before the one of the 250 * iterator gets released. */ 251 ComObjPtr<GuestSession> pCurSession = pSession; 252 253 LogFlowThisFunc(("Removing session (pSession=%p, ID=%RU32) (now total %ld sessions)\n", 254 pSession, pSession->i_getId(), mData.mGuestSessions.size() - 1)); 255 256 rc = pSession->i_onRemove(); 257 mData.mGuestSessions.erase(itSessions); 258 259 alock.release(); /* Release lock before firing off event. */ 260 261 fireGuestSessionRegisteredEvent(mEventSource, pCurSession, 262 false /* Unregistered */); 263 pCurSession.setNull(); 264 break; 265 } 266 267 ++itSessions; 268 } 234 LogFlowThisFunc(("Removing session (ID=%RU32) ...\n", uSessionID)); 235 236 GuestSessions::const_iterator itSessions = mData.mGuestSessions.find(uSessionID); 237 if (itSessions == mData.mGuestSessions.end()) 238 return VERR_NOT_FOUND; 239 240 /* Make sure to consume the pointer before the one of the 241 * iterator gets released. */ 242 ComObjPtr<GuestSession> pSession = itSessions->second; 243 244 LogFlowThisFunc(("Removing session %RU32 (now total %ld sessions)\n", 245 pSession, uSessionID, mData.mGuestSessions.size() ? mData.mGuestSessions.size() - 1 : 0)); 246 247 rc = pSession->i_onRemove(); 248 mData.mGuestSessions.erase(itSessions); 249 250 alock.release(); /* Release lock before firing off event. */ 251 252 fireGuestSessionRegisteredEvent(mEventSource, pSession, false /* Unregistered */); 253 pSession.setNull(); 269 254 270 255 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r71560 r71634 2534 2534 2535 2535 /* Remove ourselves from the session list. */ 2536 int rc2 = mParent->i_sessionRemove(this); 2536 AssertPtr(mParent); 2537 int rc2 = mParent->i_sessionRemove(mData.mSession.mID); 2537 2538 if (rc2 == VERR_NOT_FOUND) /* Not finding the session anymore isn't critical. */ 2538 2539 rc2 = VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.