VirtualBox

Changeset 93168 in vbox for trunk/src


Ignore:
Timestamp:
Jan 10, 2022 6:00:59 PM (3 years ago)
Author:
vboxsync
Message:

Guest Control/Main: Use i_setSessionStatus() in GuestSession::i_startSession() to have and use one centralized way of setting a session's status.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r93167 r93168  
    21482148 *                              was returned. Optional.
    21492149 *
    2150  * @note    Takes the write lock.
     2150 * @note    Takes the read and write locks.
    21512151 */
    21522152int GuestSession::i_startSession(int *prcGuest)
    21532153{
    2154     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     2154    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    21552155
    21562156    LogFlowThisFunc(("mID=%RU32, mName=%s, uProtocolVersion=%RU32, openFlags=%x, openTimeoutMS=%RU32\n",
     
    21622162    if (mData.mProtocolVersion < 2)
    21632163    {
    2164         mData.mStatus = GuestSessionStatus_Started;
    2165 
     2164        alock.release(); /* Release lock before changing status. */
     2165
     2166        /* ignore rc */ i_setSessionStatus(GuestSessionStatus_Started, VINF_SUCCESS);
    21662167        LogFlowThisFunc(("Installed Guest Additions don't support opening dedicated sessions, skipping\n"));
    21672168        return VINF_SUCCESS;
     
    21732174    /** @todo mData.mSession.uFlags validation. */
    21742175
     2176    alock.release(); /* Release lock before changing status. */
     2177
    21752178    /* Set current session status. */
    2176     mData.mStatus = GuestSessionStatus_Starting;
    2177     mData.mRC     = VINF_SUCCESS; /* Clear previous error, if any. */
    2178 
    2179     int vrc;
     2179    int vrc = i_setSessionStatus(GuestSessionStatus_Starting, VINF_SUCCESS);
     2180    if (RT_FAILURE(vrc))
     2181        return vrc;
    21802182
    21812183    GuestWaitEvent *pEvent = NULL;
     
    21942196    if (RT_FAILURE(vrc))
    21952197        return vrc;
     2198
     2199    alock.acquire(); /* Re-acquire lock before accessing session attributes below. */
    21962200
    21972201    VBOXHGCMSVCPARM paParms[8];
     
    22192223    else
    22202224    {
    2221         alock.acquire(); /* Re-aquire lock before changing status. */
    2222 
    22232225        /*
    22242226         * Unable to start guest session - update its current state.
     
    22272229         * same function again will work though.
    22282230         */
    2229         mData.mStatus = GuestSessionStatus_Error;
    2230         mData.mRC = vrc;
     2231        /* ignore rc */ i_setSessionStatus(GuestSessionStatus_Error, vrc);
    22312232    }
    22322233
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