VirtualBox

Changeset 86691 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 23, 2020 2:55:35 PM (4 years ago)
Author:
vboxsync
Message:

Shared Clipboard/HostService: Refined ShClX11RequestFromX11CompleteCallback().

File:
1 edited

Legend:

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

    r85983 r86691  
    277277 * @param  pCtx                 Request context information.
    278278 * @param  rcCompletion         The completion status of the request.
    279  * @param  pReq                 Request to complete.
     279 * @param  pReq                 Request to complete. Will be free'd by the callback.
    280280 * @param  pv                   Address of data from completed request. Optional.
    281281 * @param  cb                   Size (in bytes) of data from completed request. Optional.
     
    286286                                                         CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
    287287{
     288    AssertPtrReturnVoid(pCtx);
    288289    RT_NOREF(rcCompletion);
     290    AssertPtrReturnVoid(pReq);
    289291
    290292    LogFlowFunc(("rcCompletion=%Rrc, pReq=%p, pv=%p, cb=%RU32, idEvent=%RU32\n", rcCompletion, pReq, pv, cb, pReq->idEvent));
    291293
    292     AssertMsgRC(rcCompletion, ("Clipboard data completion from X11 failed with %Rrc\n", rcCompletion));
    293 
    294294    if (pReq->idEvent != NIL_SHCLEVENTID)
    295295    {
     
    297297
    298298        PSHCLEVENTPAYLOAD pPayload = NULL;
    299         if (pv && cb)
     299        if (   RT_SUCCESS(rcCompletion)
     300            && pv
     301            && cb)
    300302        {
    301303            rc2 = ShClPayloadAlloc(pReq->idEvent, pv, cb, &pPayload);
     
    303305        }
    304306
    305         RTCritSectEnter(&pCtx->pClient->CritSect);
    306         rc2 = ShClEventSignal(&pCtx->pClient->EventSrc, pReq->idEvent, pPayload);
    307         AssertRC(rc2);
    308         RTCritSectLeave(&pCtx->pClient->CritSect);
    309     }
    310 
    311     RTMemFree(pReq);
     307        rc2 = RTCritSectEnter(&pCtx->pClient->CritSect);
     308        if (RT_SUCCESS(rc2))
     309        {
     310            ShClEventSignal(&pCtx->pClient->EventSrc, pReq->idEvent, pPayload);
     311            /* Note: Skip checking if signalling the event is successful, as it could be gone already by now. */
     312            RTCritSectLeave(&pCtx->pClient->CritSect);
     313        }
     314    }
     315
     316    if (pReq)
     317        RTMemFree(pReq);
    312318}
    313319
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