VirtualBox

Changeset 93166 in vbox for trunk


Ignore:
Timestamp:
Jan 10, 2022 4:43:04 PM (3 years ago)
Author:
vboxsync
Message:

Guest Control/Main: Renamed Guest::i_sessionRemove() -> Guest::i_sessionDestroy() to better match the function's meaning (also to Guest::i_sessionCreate()).

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GuestImpl.h

    r93115 r93166  
    119119#ifdef VBOX_WITH_GUEST_CONTROL
    120120    int         i_dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
    121     int         i_sessionRemove(uint32_t uSessionID);
    122121    int         i_sessionCreate(const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds,
    123122                                ComObjPtr<GuestSession> &pGuestSession);
     123    int         i_sessionDestroy(uint32_t uSessionID);
    124124    inline bool i_sessionExists(uint32_t uSessionID);
    125125    /** Returns the VBOX_GUESTCTRL_GF_0_XXX mask reported by the guest. */
  • trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp

    r93115 r93166  
    240240
    241241/**
    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 the
    262      * 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 /**
    281242 * Creates a new guest session.
    282243 * This will invoke VBoxService running on the guest creating a new (dedicated) guest session
     
    289250 *                              The specified user must be able to logon to the guest and able to start new processes.
    290251 * @param   pGuestSession       Where to store the created guest session on success.
     252 *
     253 * @note    Takes the write lock.
    291254 */
    292255int Guest::i_sessionCreate(const GuestSessionStartupInfo &ssInfo,
     
    371334
    372335/**
     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 */
     343int 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/**
    373377 * Returns whether a guest control session with a specific ID exists or not.
    374378 *
    375379 * @returns Returns \c true if the session exists, \c false if not.
    376380 * @param   uSessionID          ID to check for.
     381 *
     382 * @note    No locking done, as inline function!
    377383 */
    378384inline bool Guest::i_sessionExists(uint32_t uSessionID)
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r93164 r93166  
    33243324     * work first and then return an error. */
    33253325
    3326     /* Remove ourselves from the session list. */
     3326    /* Destroy session + remove ourselves from the session list. */
    33273327    AssertPtr(mParent);
    3328     int vrc2 = mParent->i_sessionRemove(mData.mSession.mID);
     3328    int vrc2 = mParent->i_sessionDestroy(mData.mSession.mID);
    33293329    if (vrc2 == VERR_NOT_FOUND) /* Not finding the session anymore isn't critical. */
    33303330        vrc2 = VINF_SUCCESS;
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