- Timestamp:
- Jan 18, 2024 3:32:39 PM (11 months ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp
r100676 r102954 1162 1162 * 1163 1163 * @returns VBox status code. 1164 * @param pTransferCtx Clipboard transfer to destroy. 1164 * @param pTransfer Clipboard transfer to destroy. 1165 * The pointer will be invalid after return. 1165 1166 */ 1166 1167 int ShClTransferDestroy(PSHCLTRANSFER pTransfer) … … 1195 1196 1196 1197 ShClEventSourceDestroy(&pTransfer->Events); 1198 1199 RTMemFree(pTransfer); 1200 pTransfer = NULL; 1197 1201 1198 1202 LogFlowFuncLeave(); … … 2679 2683 RTListForEachSafe(&pTransferCtx->List, pTransfer, pTransferNext, SHCLTRANSFER, Node) 2680 2684 { 2685 shclTransferCtxTransferRemoveAndUnregister(pTransferCtx, pTransfer); 2681 2686 ShClTransferDestroy(pTransfer); 2682 2683 shclTransferCtxTransferRemoveAndUnregister(pTransferCtx, pTransfer);2684 2685 RTMemFree(pTransfer);2686 pTransfer = NULL;2687 2687 } 2688 2688 … … 3235 3235 3236 3236 shclTransferCtxTransferRemoveAndUnregister(pTransferCtx, pTransfer); 3237 3238 3237 ShClTransferDestroy(pTransfer); 3239 3240 RTMemFree(pTransfer);3241 pTransfer = NULL;3242 3238 } 3243 3239 else -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp
r100667 r102954 2293 2293 2294 2294 ShClTransferCtxUnregisterById(pTxCtx, pTransfer->State.uID); 2295 2296 2295 ShClTransferDestroy(pTransfer); 2297 2298 RTMemFree(pTransfer);2299 pTransfer = NULL;2300 2296 } 2301 2297 } … … 2343 2339 2344 2340 if (RT_FAILURE(rc)) 2345 {2346 2341 ShClTransferDestroy(pTransfer); 2347 2348 RTMemFree(pTransfer);2349 pTransfer = NULL;2350 }2351 2342 2352 2343 if (RT_FAILURE(rc)) … … 2383 2374 2384 2375 ShClTransferDestroy(pTransfer); 2385 2386 RTMemFree(pTransfer);2387 2376 pTransfer = NULL; 2388 2377 -
trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardTransfers.cpp
r100641 r102954 291 291 } 292 292 293 ShClTransferObjOpenParmsDestroy(&openCreateParms); 294 293 295 rc = ShClTransferDestroy(pTransfer); 294 296 RTTESTI_CHECK_RC_OK(rc); … … 310 312 ShClEventSourceReset(&Source); 311 313 RTTESTI_CHECK(ShClEventSourceGetLast(&Source) == NULL); /* Event still valid, but removed from the source. */ 312 RTTESTI_CHECK(ShClEventRelease(pEvent) == 0); 313 RTTESTI_CHECK(ShClEventRelease(pEvent) == UINT32_MAX); /* Ref count already was 0, so returns UINT32_MAX. */ 314 RTTESTI_CHECK(ShClEventRelease(pEvent) == UINT32_MAX); /* Again. */ 314 RTTESTI_CHECK(ShClEventRelease(pEvent) == 0); /* Free'd event, as ref count is 0. */ 315 315 RTTESTI_CHECK(ShClEventSourceGetLast(&Source) == NULL); /* Now it should be empty. */ 316 316 RTTESTI_CHECK_RC_OK(ShClEventSourceDestroy(&Source)); … … 325 325 RTTESTI_CHECK(ShClEventRelease(pEvent) == 1); 326 326 RTTESTI_CHECK(ShClEventGetRefs(pEvent) == 1); 327 RTTESTI_CHECK(ShClEventRelease(pEvent) == 0); /* Destroys event, as ref count is 0. */ 328 RTTESTI_CHECK(ShClEventRelease(pEvent) == UINT32_MAX); 327 RTTESTI_CHECK(ShClEventRelease(pEvent) == 0); /* Free'd event, as ref count is 0. */ 329 328 RTTESTI_CHECK_RC_OK(ShClEventSourceDestroy(&Source)); /* Try to destruct again. */ 330 329 } … … 339 338 rc = ShClTransferDestroy(pTransfer); 340 339 RTTESTI_CHECK_RC_OK(rc); 340 pTransfer = NULL; /* Was free'd above. */ 341 341 rc = ShClTransferDestroy(pTransfer); /* Second time, intentional. */ 342 342 RTTESTI_CHECK_RC_OK(rc); … … 354 354 ShClTransferListEntryDestroy(&Entry); 355 355 ShClTransferListEntryDestroy(&Entry); /* Second time, intentional. */ 356 357 rc = ShClTransferDestroy(pTransfer); 358 RTTESTI_CHECK_RC_OK(rc); 356 359 } 357 360
Note:
See TracChangeset
for help on using the changeset viewer.