VirtualBox

Changeset 92239 in vbox for trunk


Ignore:
Timestamp:
Nov 5, 2021 2:14:54 PM (3 years ago)
Author:
vboxsync
Message:

SharedClipboard: Poor code structure in svcConnect made it forget to call ShClBackendDisconnect on ShClBackendSync failure. bugref:10135

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp

    r92017 r92239  
    496496void shClSvcMsgAdd(PSHCLCLIENT pClient, PSHCLCLIENTMSG pMsg, bool fAppend)
    497497{
    498     Assert(RTCritSectIsOwned(&pClient->CritSect));
     498    Assert(RTCritSectIsOwner(&pClient->CritSect));
    499499    AssertPtr(pMsg);
    500500
     
    522522int shClSvcMsgAddAndWakeupClient(PSHCLCLIENT pClient, PSHCLCLIENTMSG pMsg)
    523523{
    524     Assert(RTCritSectIsOwned(&pClient->CritSect));
     524    Assert(RTCritSectIsOwner(&pClient->CritSect));
    525525    AssertPtr(pMsg);
    526526    AssertPtr(pClient);
     
    20712071            if (RT_SUCCESS(rc))
    20722072            {
    2073                 /* For now we ASSUME that the first client ever connected is in charge for
    2074                  * communicating withe the service extension.
    2075                  *
    2076                  ** @todo This needs to be fixed ASAP w/o breaking older guest / host combos. */
     2073                /* For now we ASSUME that the first client that connects is in charge for
     2074                   communicating with the service extension. */
     2075                /** @todo This isn't optimal, but only the guest really knows which client is in
     2076                 *        focus on the console. See @bugref{10115} for details. */
    20772077                if (g_ExtState.uClientID == 0)
    20782078                    g_ExtState.uClientID = u32ClientID;
     2079
     2080                LogFunc(("Successfully connected client %#x\n", u32ClientID));
     2081                return rc;
    20792082            }
    2080         }
    2081 
    2082         if (RT_FAILURE(rc))
    2083         {
    2084             shClSvcClientDestroy(pClient);
    2085         }
    2086 
    2087     }
    2088 
     2083
     2084            LogFunc(("ShClBackendSync failed: %Rrc\n", rc));
     2085            ShClBackendDisconnect(pClient);
     2086        }
     2087        else
     2088            LogFunc(("ShClBackendConnect failed: %Rrc\n", rc));
     2089        shClSvcClientDestroy(pClient);
     2090    }
     2091    else
     2092        LogFunc(("shClSvcClientInit failed: %Rrc\n", rc));
    20892093    LogFlowFuncLeaveRC(rc);
    20902094    return rc;
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