- Timestamp:
- Jan 10, 2022 4:43:04 PM (3 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestImpl.h
r93115 r93166 119 119 #ifdef VBOX_WITH_GUEST_CONTROL 120 120 int i_dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb); 121 int i_sessionRemove(uint32_t uSessionID);122 121 int i_sessionCreate(const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds, 123 122 ComObjPtr<GuestSession> &pGuestSession); 123 int i_sessionDestroy(uint32_t uSessionID); 124 124 inline bool i_sessionExists(uint32_t uSessionID); 125 125 /** Returns the VBOX_GUESTCTRL_GF_0_XXX mask reported by the guest. */ -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r93115 r93166 240 240 241 241 /** 242 * Removes a guest control session from the internal list and destroys the session.243 *244 * @returns VBox status code.245 * @param uSessionID ID of the guest control session to remove.246 */247 int Guest::i_sessionRemove(uint32_t uSessionID)248 {249 LogFlowThisFuncEnter();250 251 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);252 253 int rc = VERR_NOT_FOUND;254 255 LogFlowThisFunc(("Removing session (ID=%RU32) ...\n", uSessionID));256 257 GuestSessions::iterator itSessions = mData.mGuestSessions.find(uSessionID);258 if (itSessions == mData.mGuestSessions.end())259 return VERR_NOT_FOUND;260 261 /* Make sure to consume the pointer before the one of the262 * iterator gets released. */263 ComObjPtr<GuestSession> pSession = itSessions->second;264 265 LogFlowThisFunc(("Removing session %RU32 (now total %ld sessions)\n",266 uSessionID, mData.mGuestSessions.size() ? mData.mGuestSessions.size() - 1 : 0));267 268 rc = pSession->i_onRemove();269 mData.mGuestSessions.erase(itSessions);270 271 alock.release(); /* Release lock before firing off event. */272 273 ::FireGuestSessionRegisteredEvent(mEventSource, pSession, false /* Unregistered */);274 pSession.setNull();275 276 LogFlowFuncLeaveRC(rc);277 return rc;278 }279 280 /**281 242 * Creates a new guest session. 282 243 * This will invoke VBoxService running on the guest creating a new (dedicated) guest session … … 289 250 * The specified user must be able to logon to the guest and able to start new processes. 290 251 * @param pGuestSession Where to store the created guest session on success. 252 * 253 * @note Takes the write lock. 291 254 */ 292 255 int Guest::i_sessionCreate(const GuestSessionStartupInfo &ssInfo, … … 371 334 372 335 /** 336 * Destroys a given guest session and removes it from the internal list. 337 * 338 * @returns VBox status code. 339 * @param uSessionID ID of the guest control session to destroy. 340 * 341 * @note Takes the write lock. 342 */ 343 int Guest::i_sessionDestroy(uint32_t uSessionID) 344 { 345 LogFlowThisFuncEnter(); 346 347 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 348 349 int rc = VERR_NOT_FOUND; 350 351 LogFlowThisFunc(("Destroying session (ID=%RU32) ...\n", uSessionID)); 352 353 GuestSessions::iterator itSessions = mData.mGuestSessions.find(uSessionID); 354 if (itSessions == mData.mGuestSessions.end()) 355 return VERR_NOT_FOUND; 356 357 /* Make sure to consume the pointer before the one of the 358 * iterator gets released. */ 359 ComObjPtr<GuestSession> pSession = itSessions->second; 360 361 LogFlowThisFunc(("Removing session %RU32 (now total %ld sessions)\n", 362 uSessionID, mData.mGuestSessions.size() ? mData.mGuestSessions.size() - 1 : 0)); 363 364 rc = pSession->i_onRemove(); 365 mData.mGuestSessions.erase(itSessions); 366 367 alock.release(); /* Release lock before firing off event. */ 368 369 ::FireGuestSessionRegisteredEvent(mEventSource, pSession, false /* Unregistered */); 370 pSession.setNull(); 371 372 LogFlowFuncLeaveRC(rc); 373 return rc; 374 } 375 376 /** 373 377 * Returns whether a guest control session with a specific ID exists or not. 374 378 * 375 379 * @returns Returns \c true if the session exists, \c false if not. 376 380 * @param uSessionID ID to check for. 381 * 382 * @note No locking done, as inline function! 377 383 */ 378 384 inline bool Guest::i_sessionExists(uint32_t uSessionID) -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r93164 r93166 3324 3324 * work first and then return an error. */ 3325 3325 3326 /* Remove ourselves from the session list. */3326 /* Destroy session + remove ourselves from the session list. */ 3327 3327 AssertPtr(mParent); 3328 int vrc2 = mParent->i_session Remove(mData.mSession.mID);3328 int vrc2 = mParent->i_sessionDestroy(mData.mSession.mID); 3329 3329 if (vrc2 == VERR_NOT_FOUND) /* Not finding the session anymore isn't critical. */ 3330 3330 vrc2 = VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.