VirtualBox

Changeset 85985 in vbox


Ignore:
Timestamp:
Sep 1, 2020 5:46:22 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
140181
Message:

Shared Clipboard/Host Service: Automatically unregister event if it has no (more) references in ShClSvcGuestDataReceived(). bugref:9437

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/GuestHost/SharedClipboard.h

    r83624 r85985  
    175175SHCLEVENTID ShClEventIdGenerateAndRegister(PSHCLEVENTSOURCE pSource);
    176176SHCLEVENTID ShClEventGetLast(PSHCLEVENTSOURCE pSource);
     177uint32_t ShClEventGetRefs(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
    177178uint32_t ShClEventRetain(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
    178179uint32_t ShClEventRelease(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent);
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp

    r85864 r85985  
    259259        return pEvent->idEvent;
    260260
     261    return 0;
     262}
     263
     264/**
     265 * Returns the current reference count for a specific event.
     266 *
     267 * @returns Reference count.
     268 * @param   pSource             Event source the specific event is part of.
     269 * @param   idEvent             Event ID to return reference count for.
     270 */
     271uint32_t ShClEventGetRefs(PSHCLEVENTSOURCE pSource, SHCLEVENTID idEvent)
     272{
     273    PSHCLEVENT pEvent = shclEventGet(pSource, idEvent);
     274    if (pEvent)
     275        return pEvent->cRefs;
     276
     277    AssertMsgFailed(("No event with %RU32\n", idEvent));
    261278    return 0;
    262279}
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp

    r85983 r85985  
    13371337        if (RT_FAILURE(rc))
    13381338            ShClPayloadFree(pPayload);
     1339
     1340        /* No one holding a reference to the event event anymore? Unregister it. */
     1341        if (ShClEventGetRefs(&pClient->EventSrc, idEvent) == 0)
     1342        {
     1343            int rc2 = ShClEventUnregister(&pClient->EventSrc, idEvent);
     1344            if (RT_SUCCESS(rc))
     1345                rc = rc2;
     1346        }
    13391347    }
    13401348
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