Changeset 80845 in vbox for trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp
- Timestamp:
- Sep 17, 2019 9:05:21 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp
r80662 r80845 180 180 RTListForEachSafe(&pSource->lstEvents, pEvIt, pEvItNext, SHCLEVENT, Node) 181 181 { 182 RTListNodeRemove(&pEvIt->Node); 183 182 184 SharedClipboardEventDestroy(pEvIt); 185 183 186 RTMemFree(pEvIt); 187 pEvIt = NULL; 184 188 } 185 189 … … 199 203 200 204 LogFlowFunc(("uSource=%RU16: New event: %RU16\n", pSource->uID, pSource->uEventIDNext)); 201 return pSource->uEventIDNext++; /** @todo Handle rollovers? */ 205 206 pSource->uEventIDNext++; 207 if (pSource->uEventIDNext == VBOX_SHARED_CLIPBOARD_MAX_EVENTS) 208 pSource->uEventIDNext = 0; 209 210 return pSource->uEventIDNext; 202 211 } 203 212 … … 235 244 236 245 return 0; 246 } 247 248 /** 249 * Detaches a payload from an event, internal version. 250 * 251 * @param pEvent Event to detach payload for. 252 */ 253 static void sharedClipboardEventPayloadDetachInternal(PSHCLEVENT pEvent) 254 { 255 AssertPtrReturnVoid(pEvent); 256 257 pEvent->pPayload = NULL; 237 258 } 238 259 … … 324 345 * @param uTimeoutMs Timeout (in ms) to wait. 325 346 * @param ppPayload Where to store the (allocated) event payload on success. Needs to be free'd with 326 * SharedClipboardPayloadFree(). 347 * SharedClipboardPayloadFree(). Optional. 327 348 */ 328 349 int SharedClipboardEventWait(PSHCLEVENTSOURCE pSource, SHCLEVENTID uID, RTMSINTERVAL uTimeoutMs, … … 330 351 { 331 352 AssertPtrReturn(pSource, VERR_INVALID_POINTER); 353 /** ppPayload is optional. */ 332 354 333 355 LogFlowFuncEnter(); … … 341 363 if (RT_SUCCESS(rc)) 342 364 { 343 *ppPayload = pEvent->pPayload; 344 345 pEvent->pPayload = NULL; 365 if (ppPayload) 366 { 367 *ppPayload = pEvent->pPayload; 368 369 /* Make sure to detach payload here, as the caller now owns the data. */ 370 sharedClipboardEventPayloadDetachInternal(pEvent); 371 } 346 372 } 347 373 } … … 402 428 if (pEvent) 403 429 { 404 pEvent->pPayload = NULL;430 sharedClipboardEventPayloadDetachInternal(pEvent); 405 431 } 406 432 #ifdef DEBUG_andy … … 803 829 RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA); 804 830 RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS_REPORT); 805 RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_TRANSFER_STA RT);831 RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_TRANSFER_STATUS); 806 832 RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_HDR_READ); 807 833 RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_HDR_WRITE);
Note:
See TracChangeset
for help on using the changeset viewer.