VirtualBox

Changeset 92772 in vbox


Ignore:
Timestamp:
Dec 6, 2021 7:09:30 PM (3 years ago)
Author:
vboxsync
Message:

Host Services: Shared Clipboard: reference counting fix for events produced by ShClEventSourceGenerateAndRegisterEvent(), bugref:10160.

In this commit, ShClEventSourceGenerateAndRegisterEvent() takes reference to created event,
release reference is expected to be released by caller.

Location:
trunk/src/VBox
Files:
2 edited

Legend:

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

    r92735 r92772  
    240240                    LogFlowFunc(("uSource=%RU16: New event: %#x\n", pSource->uID, idEvent));
    241241
     242                    ShClEventRetain(pEvent);
    242243                    *ppEvent = pEvent;
    243244
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp

    r92735 r92772  
    12931293                    shClSvcMsgAdd(pClient, pMsg, true /* fAppend */);
    12941294
    1295                     /* Retain the last event generated (in case there were multiple clipboard formats)
    1296                      * if we need to return the event to the caller. */
     1295                    /* Return event handle to the caller if requested. */
    12971296                    if (ppEvent)
    12981297                    {
    1299                         ShClEventRetain(pEvent);
    13001298                        *ppEvent = pEvent;
    13011299                    }
    13021300
    13031301                    shClSvcClientWakeup(pClient);
     1302                }
     1303
     1304                /* Remove event from list if caller did not request event handle or in case
     1305                 * of failure (in this case caller should not release event). */
     1306                if (   RT_FAILURE(rc)
     1307                    || !ppEvent)
     1308                {
     1309                    ShClEventRelease(pEvent);
    13041310                }
    13051311            }
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