VirtualBox

Changeset 85798 in vbox


Ignore:
Timestamp:
Aug 17, 2020 12:55:46 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139955
Message:

Shared Clipboard/X11: Only write clipboard data when clipboard request has succeeded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp

    r83624 r85798  
    191191 *
    192192 * @param  pCtx                 Our context information.
    193  * @param  rc                   The IPRT result code of the request.
     193 * @param  rcCompletion         The completion status of the request.
    194194 * @param  pReq                 The request structure that we passed in when we started
    195195 *                              the request.  We RTMemFree() this in this function.
     
    197197 * @param  cb                   The size of the data in @a pv.
    198198 */
    199 DECLCALLBACK(void) ShClX11RequestFromX11CompleteCallback(PSHCLCONTEXT pCtx, int rc, CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
    200 {
    201     RT_NOREF(pCtx, rc);
    202 
    203     LogFlowFunc(("rc=%Rrc, Format=0x%x, pv=%p, cb=%RU32\n", rc, pReq->Format, pv, cb));
    204 
    205     int rc2 = VbglR3ClipboardWriteDataEx(&pCtx->CmdCtx, pReq->Format, pv, cb);
    206     RT_NOREF(rc2);
     199DECLCALLBACK(void) ShClX11RequestFromX11CompleteCallback(PSHCLCONTEXT pCtx,
     200                                                         int rcCompletion, CLIPREADCBREQ *pReq, void *pv, uint32_t cb)
     201{
     202    LogFlowFunc(("rcCompletion=%Rrc, Format=0x%x, pv=%p, cb=%RU32\n", rcCompletion, pReq->Format, pv, cb));
     203
     204    if (RT_SUCCESS(rcCompletion)) /* Only write data if the request succeeded. */
     205    {
     206        AssertPtrReturnVoid(pv);
     207        AssertReturnVoid(pv);
     208
     209        rcCompletion = VbglR3ClipboardWriteDataEx(&pCtx->CmdCtx, pReq->Format, pv, cb);
     210    }
    207211
    208212    RTMemFree(pReq);
    209213
    210     LogFlowFuncLeaveRC(rc2);
     214    LogFlowFuncLeaveRC(rcCompletion);
    211215}
    212216
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette