VirtualBox

Changeset 97764 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Dec 8, 2022 3:47:13 PM (2 years ago)
Author:
vboxsync
Message:

DnD: Renamed the VbglR3 event name VBGLR3DNDEVENTTYPE_HG_CANCEL -> VBGLR3DNDEVENTTYPE_CANCEL, to emphasize that this is an event for both directions (host -> guest / guest -> host). Fixed a memory leak in vbglR3DnDHGRecvDataMain().

Location:
trunk/src/VBox/Additions
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.cpp

    r97748 r97764  
    614614                }
    615615
    616                 case VBGLR3DNDEVENTTYPE_HG_CANCEL:
     616                case VBGLR3DNDEVENTTYPE_CANCEL:
    617617                {
    618618                    rc = OnHgCancel();
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDragAndDrop.cpp

    r97748 r97764  
    401401 *
    402402 * @returns IPRT status code.
     403 * @retval  VERR_CANCELLED if the transfer was cancelled by the host.
    403404 * @param   pCtx                DnD context to use.
    404405 * @param   pDataHdr            DnD data header to use. Needed for accounting.
     
    657658    if (RT_FAILURE(rc))
    658659    {
    659         LogRel(("DnD: Receiving URI data failed with %Rrc\n", rc));
     660        if (rc == VERR_CANCELLED)
     661            LogRel2(("DnD: Receiving URI data was cancelled by the host\n"));
     662        else
     663            LogRel(("DnD: Receiving URI data failed with %Rrc\n", rc));
    660664
    661665        DnDTransferObjectDestroy(&objCur);
     
    864868 * Main function for receiving the actual DnD data from the host.
    865869 *
    866  * @returns IPRT status code.
     870 * @returns VBox status code.
     871 * @retval  VERR_CANCELLED if cancelled by the host.
    867872 * @param   pCtx                DnD context to use.
    868873 * @param   pMeta               Where to store the actual meta data received from the host.
     
    885890    void    *pvData = NULL;
    886891    uint64_t cbData = 0;
    887 
    888892    int rc = vbglR3DnDHGRecvDataLoop(pCtx, &dataHdr, &pvData, &cbData);
    889893    if (RT_SUCCESS(rc))
     
    944948            pMeta->enmType = VBGLR3GUESTDNDMETADATATYPE_RAW;
    945949        }
     950
     951        if (pvData)
     952            RTMemFree(pvData);
    946953    }
    947954
     
    951958    if (RT_FAILURE(rc))
    952959    {
    953         if (pvData)
    954             RTMemFree(pvData);
    955 
    956960        if (rc != VERR_CANCELLED)
    957961        {
     
    11981202 * protocol actually is working.
    11991203 *
    1200  * @returns IPRT status code.
     1204 * @returns VBox status code.
    12011205 * @param   pCtx                DnD context to work with.
    12021206 * @param   ppEvent             Next DnD event received on success; needs to be free'd by the client calling
     
    13241328                rc = vbglR3DnDHGRecvCancel(pCtx);
    13251329                if (RT_SUCCESS(rc))
    1326                     pEvent->enmType = VBGLR3DNDEVENTTYPE_HG_CANCEL;
     1330                    rc = VERR_CANCELLED; /* Will emit a cancel event below. */
    13271331                break;
    13281332            }
     
    13561360    if (RT_FAILURE(rc))
    13571361    {
    1358         VbglR3DnDEventFree(pEvent);
    1359         LogRel(("DnD: Handling message %s (%#x) failed with %Rrc\n", DnDHostMsgToStr(uMsg), uMsg, rc));
    1360     }
    1361     else
     1362        /* Current operation cancelled? Set / overwrite event type and tell the caller. */
     1363        if (rc == VERR_CANCELLED)
     1364        {
     1365            pEvent->enmType = VBGLR3DNDEVENTTYPE_CANCEL;
     1366            rc              = VINF_SUCCESS; /* Deliver the event to the caller. */
     1367        }
     1368        else
     1369        {
     1370            VbglR3DnDEventFree(pEvent);
     1371            LogRel(("DnD: Handling message %s (%#x) failed with %Rrc\n", DnDHostMsgToStr(uMsg), uMsg, rc));
     1372        }
     1373    }
     1374
     1375    if (RT_SUCCESS(rc))
    13621376        *ppEvent = pEvent;
    13631377
     1378    LogFlowFuncLeaveRC(rc);
    13641379    return rc;
    13651380}
  • trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp

    r97748 r97764  
    34253425                        }
    34263426
    3427                         case VBGLR3DNDEVENTTYPE_HG_CANCEL:
     3427                        case VBGLR3DNDEVENTTYPE_CANCEL:
    34283428                        {
    3429                             m_pCurDnD->reset(); /** @todo Test this! */
     3429                            m_pCurDnD->reset();
    34303430                            break;
    34313431                        }
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