VirtualBox

Ignore:
Timestamp:
Nov 13, 2017 9:53:03 AM (7 years ago)
Author:
vboxsync
Message:

GuestHost/SharedClipboard/x11: schedule synchronisation mechanism removal.
bugref:9041: clipboard sharing on macOS host is brittle, Guest->Host direction

The GuestHost part of the X11 shared clipboard code contains a synchronisation
mechanism in the form of a flag which is set before an X11 clipboard request
is triggered and cleared when it completes. This is because the Xt toolkit,
which we use for the shared clipboard, does not support multiple clipboard
operations at once. However, we run all X11 clipboard code on a single thread,
and any function which sets the flag also waits for the operation to complete,
so the flag should not be necessary at all. What is more, if there is any
valid use for it it is far from clear that it would actually work as intended.
This change schedules it for removal after 5.2 using conditional compilation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp

    r69656 r69668  
    4949
    5050#include <VBox/log.h>
     51#include <VBox/version.h>
    5152
    5253#include <VBox/GuestHost/SharedClipboard.h>
    5354#include <VBox/GuestHost/clipboard-helper.h>
    5455#include <VBox/HostServices/VBoxClipboardSvc.h>
     56
     57/* The serialisation mechanism looks like it is not needed (everything using it
     58 * runs on one thread, and the flag is always cleared at the end of calls which
     59 * use it).  So we will remove it after the 5.2 series. */
     60#if (VBOX_VERSION_MAJOR * 100000 + VBOX_VERSION_MINOR * 1000 + VBOX_VERION_BUILD >= 502051)
     61# define VBOX_AFTER_5_2
     62#endif
    5563
    5664class formats;
     
    215223    /** The first XFixes event number */
    216224    int fixesEventBase;
     225#ifndef VBOX_AFTER_5_2
    217226    /** The Xt Intrinsics can only handle one outstanding clipboard operation
    218227     * at a time, so we keep track of whether one is in process. */
     
    221230     * it for later. */
    222231    bool fUpdateNeeded;
     232#endif
    223233};
    224234
     
    530540{
    531541    LogRel2 (("%s: called\n", __FUNCTION__));
     542#ifndef VBOX_AFTER_5_2
    532543    pCtx->fBusy = false;
    533544    if (pCtx->fUpdateNeeded)
     
    538549        return;
    539550    }
     551#endif
    540552    if (pTargets == NULL) {
    541553        /* No data available */
     
    620632    LogRel2 (("%s: requesting the targets that the X11 clipboard offers\n",
    621633           __PRETTY_FUNCTION__));
     634#ifndef VBOX_AFTER_5_2
    622635    if (pCtx->fBusy)
    623636    {
     
    626639    }
    627640    pCtx->fBusy = true;
     641#endif
    628642#ifndef TESTCASE
    629643    XtGetSelectionValue(pCtx->widget,
     
    17361750    Assert(pReq->mFormat != 0);  /* sanity */
    17371751    int rc = VINF_SUCCESS;
     1752#ifndef VBOX_AFTER_5_2
    17381753    CLIPBACKEND *pCtx = pReq->mCtx;
     1754#endif
    17391755    void *pvDest = NULL;
    17401756    uint32_t cbDest = 0;
    17411757
     1758#ifndef VBOX_AFTER_5_2
    17421759    pCtx->fBusy = false;
    17431760    if (pCtx->fUpdateNeeded)
    17441761        clipQueryX11CBFormats(pCtx);
     1762#endif
    17451763    if (pvSrc == NULL)
    17461764        /* The clipboard selection may have changed before we could get it. */
     
    19111929
    19121930    int rc = VINF_SUCCESS;
     1931#ifndef VBOX_AFTER_5_2
    19131932    bool fBusy = pCtx->fBusy;
    19141933    pCtx->fBusy = true;
     
    19161935        /* If the clipboard is busy just fend off the request. */
    19171936        rc = VERR_TRY_AGAIN;
    1918     else if (pReq->mFormat == VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT)
     1937    else
     1938#endif
     1939    if (pReq->mFormat == VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT)
    19191940    {
    19201941        /*
     
    19571978    {
    19581979        rc = VERR_NOT_IMPLEMENTED;
     1980#ifndef VBOX_AFTER_5_2
    19591981        pCtx->fBusy = false;
     1982#endif
    19601983    }
    19611984    if (RT_FAILURE(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