VirtualBox

Changeset 102461 in vbox


Ignore:
Timestamp:
Dec 5, 2023 8:32:38 AM (10 months ago)
Author:
vboxsync
Message:

Shared Clipboard: Make sure to check the event's rc when waiting for ShClX11ReadDataFromX11Async() to complete. bugref:10384

Location:
trunk/src/VBox
Files:
3 edited

Legend:

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

    r100676 r102461  
    8686                if (RT_SUCCESS(rc))
    8787                {
     88                    int               rcEvent;
    8889                    PSHCLEVENTPAYLOAD pPayload;
    89                     rc = ShClEventWait(pEvent, SHCL_TIMEOUT_DEFAULT_MS, &pPayload);
     90                    rc = ShClEventWaitEx(pEvent, SHCL_TIMEOUT_DEFAULT_MS, &rcEvent, &pPayload);
    9091                    if (RT_SUCCESS(rc))
    9192                    {
     
    103104                            ShClPayloadFree(pPayload);
    104105                        }
     106                        else /* No payload given; could happen on invalid / not-expected formats. */
     107                            *pcbActual = 0;
    105108                    }
     109                    else if (rc == VERR_SHCLPB_EVENT_FAILED)
     110                        rc = rcEvent;
    106111                }
    107112            }
     
    547552                        if (RT_SUCCESS(rc))
    548553                        {
     554                            int               rcEvent;
    549555                            PSHCLEVENTPAYLOAD pPayload;
    550                             rc = ShClEventWait(pReadDataEvent, SHCL_TIMEOUT_DEFAULT_MS, &pPayload);
     556                            rc = ShClEventWaitEx(pReadDataEvent, SHCL_TIMEOUT_DEFAULT_MS, &rcEvent, &pPayload);
    551557                            if (RT_SUCCESS(rc))
    552558                            {
     
    564570                                    ShClPayloadFree(pPayload);
    565571                                }
     572                                else /* No payload given; could happen on invalid / not-expected formats. */
     573                                    *pcbActual = 0;
    566574                            }
     575                            else if (rc == VERR_SHCLPB_EVENT_FAILED)
     576                                rc = rcEvent;
    567577                        }
    568578
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp

    r100684 r102461  
    23192319    PSHCLEVENTPAYLOAD pPayload = NULL;
    23202320    size_t            cbResp   = sizeof(SHCLX11RESPONSE);
    2321     PSHCLX11RESPONSE  pResp    = (PSHCLX11RESPONSE)RTMemAlloc(cbResp);
     2321    PSHCLX11RESPONSE  pResp    = (PSHCLX11RESPONSE)RTMemAllocZ(cbResp);
    23222322    if (pResp)
    23232323    {
     
    26152615        if (RT_SUCCESS(rc))
    26162616        {
     2617            int               rcEvent;
    26172618            PSHCLEVENTPAYLOAD pPayload;
    2618             rc = ShClEventWait(pEvent, msTimeout, &pPayload);
     2619            rc = ShClEventWaitEx(pEvent, msTimeout, &rcEvent, &pPayload);
    26192620            if (RT_SUCCESS(rc))
    26202621            {
     
    26322633                    ShClPayloadFree(pPayload);
    26332634                }
     2635                else /* No payload given; could happen on invalid / not-expected formats. */
     2636                    *pcbRead = 0;
    26342637            }
     2638            else if (rc == VERR_SHCLPB_EVENT_FAILED)
     2639                rc = rcEvent;
    26352640        }
    26362641    }
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp

    r100676 r102461  
    300300        if (RT_SUCCESS(rc))
    301301        {
     302            int               rcEvent;
    302303            PSHCLEVENTPAYLOAD pPayload;
    303             rc = ShClEventWait(pEvent, SHCL_TIMEOUT_DEFAULT_MS, &pPayload);
     304            rc = ShClEventWaitEx(pEvent, SHCL_TIMEOUT_DEFAULT_MS, &rcEvent, &pPayload);
    304305            if (RT_SUCCESS(rc))
    305306            {
     
    327328                    *pcbActual = 0;
    328329            }
     330            else if (rc == VERR_SHCLPB_EVENT_FAILED)
     331                rc = rcEvent;
    329332        }
    330333
     
    722725        {
    723726            /* X supplies the data asynchronously, so we need to wait for data to arrive first. */
     727            int               rcEvent;
    724728            PSHCLEVENTPAYLOAD pPayload;
    725             rc = ShClEventWait(pEvent, SHCL_TIMEOUT_DEFAULT_MS, &pPayload);
     729            rc = ShClEventWaitEx(pEvent, SHCL_TIMEOUT_DEFAULT_MS, &rcEvent, &pPayload);
    726730            if (RT_SUCCESS(rc))
    727731            {
     
    744748                    pPayload = NULL;
    745749                }
    746                 else
    747                     rc = VERR_NO_DATA; /* No payload. */
     750                else /* No payload given; could happen on invalid / not-expected formats. */
     751                    *pcbActual = 0;
    748752            }
     753            else if (rc == VERR_SHCLPB_EVENT_FAILED)
     754                rc = rcEvent;
    749755        }
    750756
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