Changeset 81025 in vbox for trunk/src/VBox/GuestHost/SharedClipboard
- Timestamp:
- Sep 26, 2019 4:13:25 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 133628
- Location:
- trunk/src/VBox/GuestHost/SharedClipboard
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardDataObjectImpl-win.cpp
r80905 r81025 367 367 if (ASMAtomicReadBool(&pTransfer->Thread.fStop)) 368 368 { 369 LogRel2(("Shared Clipboard: Stopping transfer calculati ng...\n"));369 LogRel2(("Shared Clipboard: Stopping transfer calculation ...\n")); 370 370 break; 371 371 } … … 378 378 pRootList = NULL; 379 379 380 if (RT_SUCCESS(rc)) 380 if ( RT_SUCCESS(rc) 381 && !ASMAtomicReadBool(&pTransfer->Thread.fStop)) 381 382 { 382 383 LogRel2(("Shared Clipboard: Transfer calculation complete (%zu root entries)\n", pThis->m_lstEntries.size())); … … 402 403 LogRel(("Shared Clipboard: No transfer root entries found -- should not happen, please file a bug report\n")); 403 404 } 404 else 405 else if (RT_FAILURE(rc)) 405 406 LogRel(("Shared Clipboard: Transfer failed with %Rrc\n", rc)); 406 407 } -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp
r80990 r81025 890 890 RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT); 891 891 RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_MSG_GET); 892 RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_STATUS);893 892 RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_REPLY); 894 893 RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_ROOT_LIST_HDR_READ); -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers.cpp
r80990 r81025 1178 1178 if (pTransfer->Callbacks.pfnTransferInitialize) 1179 1179 { 1180 SHCLTRANSFERCALLBACKDATA Data = { pTransfer, pTransfer->Callbacks.pvUser };1180 SHCLTRANSFERCALLBACKDATA Data = { pTransfer, pTransfer->Callbacks.pvUser, pTransfer->Callbacks.cbUser }; 1181 1181 rc = pTransfer->Callbacks.pfnTransferInitialize(&Data); 1182 1182 } … … 2285 2285 if (pTransfer->Callbacks.pfnTransferStart) 2286 2286 { 2287 SHCLTRANSFERCALLBACKDATA Data = { pTransfer, pTransfer->Callbacks.pvUser };2287 SHCLTRANSFERCALLBACKDATA Data = { pTransfer, pTransfer->Callbacks.pvUser, pTransfer->Callbacks.cbUser }; 2288 2288 rc = pTransfer->Callbacks.pfnTransferStart(&Data); 2289 2289 } … … 2326 2326 2327 2327 pTransfer->Callbacks.pvUser = pCallbacks->pvUser; 2328 pTransfer->Callbacks.cbUser = pCallbacks->cbUser; 2328 2329 } 2329 2330 … … 2638 2639 AssertPtrReturnVoid(pTransferCtx); 2639 2640 2640 LogFlowFunc(("pTransferCtx=%p, cTransfers=%RU 32, cRunning=%RU32\n",2641 LogFlowFunc(("pTransferCtx=%p, cTransfers=%RU16 cRunning=%RU16\n", 2641 2642 pTransferCtx, pTransferCtx->cTransfers, pTransferCtx->cRunning)); 2642 2643 2643 /* Remove all transfers which are not in a running state (e.g. only announced). */ 2644 PSHCLTRANSFER pTransfer, pTransferNext; 2645 RTListForEachSafe(&pTransferCtx->List, pTransfer, pTransferNext, SHCLTRANSFER, Node) 2646 { 2647 if (SharedClipboardTransferGetStatus(pTransfer) != SHCLTRANSFERSTATUS_STARTED) 2648 { 2649 SharedClipboardTransferDestroy(pTransfer); 2650 RTListNodeRemove(&pTransfer->Node); 2651 2652 RTMemFree(pTransfer); 2653 pTransfer = NULL; 2654 2655 Assert(pTransferCtx->cTransfers); 2656 pTransferCtx->cTransfers--; 2644 if (!RTListIsEmpty(&pTransferCtx->List)) 2645 { 2646 /* Remove all transfers which are not in a running state (e.g. only announced). */ 2647 PSHCLTRANSFER pTransfer, pTransferNext; 2648 RTListForEachSafe(&pTransferCtx->List, pTransfer, pTransferNext, SHCLTRANSFER, Node) 2649 { 2650 if (SharedClipboardTransferGetStatus(pTransfer) != SHCLTRANSFERSTATUS_STARTED) 2651 { 2652 SharedClipboardTransferDestroy(pTransfer); 2653 RTListNodeRemove(&pTransfer->Node); 2654 2655 RTMemFree(pTransfer); 2656 pTransfer = NULL; 2657 2658 Assert(pTransferCtx->cTransfers); 2659 pTransferCtx->cTransfers--; 2660 } 2657 2661 } 2658 2662 } -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-win.cpp
r80966 r81025 181 181 if (!pWinCtx) 182 182 return; 183 184 LogFlowFuncEnter(); 183 185 184 186 if (RTCritSectIsInitialized(&pWinCtx->CritSect)) … … 894 896 AssertPtrReturn(pTransfer, VERR_INVALID_POINTER); 895 897 896 LogFlowFuncEnter(); 897 898 int rc; 898 LogFlowFunc(("pWinCtx=%p\n", pWinCtx)); 899 899 900 900 AssertReturn(pTransfer->pvUser == NULL, VERR_WRONG_ORDER); 901 901 902 SharedClipboardWinTransferCtx *pWinURITransferCtx = new SharedClipboardWinTransferCtx(); 903 if (pWinURITransferCtx) 904 { 905 pTransfer->pvUser = pWinURITransferCtx; 906 pTransfer->cbUser = sizeof(SharedClipboardWinTransferCtx); 907 908 pWinURITransferCtx->pDataObj = new SharedClipboardWinDataObject(pTransfer); 909 if (pWinURITransferCtx->pDataObj) 910 { 911 rc = pWinURITransferCtx->pDataObj->Init(); 912 if (RT_SUCCESS(rc)) 902 /* Make sure to enter the critical section before setting the clipboard data, as otherwise WM_CLIPBOARDUPDATE 903 * might get called *before* we had the opportunity to set pWinCtx->hWndClipboardOwnerUs below. */ 904 int rc = RTCritSectEnter(&pWinCtx->CritSect); 905 if (RT_SUCCESS(rc)) 906 { 907 SharedClipboardWinTransferCtx *pWinURITransferCtx = new SharedClipboardWinTransferCtx(); 908 if (pWinURITransferCtx) 909 { 910 pTransfer->pvUser = pWinURITransferCtx; 911 pTransfer->cbUser = sizeof(SharedClipboardWinTransferCtx); 912 913 pWinURITransferCtx->pDataObj = new SharedClipboardWinDataObject(pTransfer); 914 if (pWinURITransferCtx->pDataObj) 913 915 { 914 SharedClipboardWinClose(); 915 /* Note: Clipboard must be closed first before calling OleSetClipboard(). */ 916 917 /** @todo There is a potential race between SharedClipboardWinClose() and OleSetClipboard(), 918 * where another application could own the clipboard (open), and thus the call to 919 * OleSetClipboard() will fail. Needs (better) fixing. */ 920 HRESULT hr = S_OK; 921 922 for (unsigned uTries = 0; uTries < 3; uTries++) 916 rc = pWinURITransferCtx->pDataObj->Init(); 917 if (RT_SUCCESS(rc)) 923 918 { 924 /* Make sure to enter the critical section before setting the clipboard data, as otherwise WM_CLIPBOARDUPDATE 925 * might get called *before* we had the opportunity to set pWinCtx->hWndClipboardOwnerUs below. */ 926 rc = RTCritSectEnter(&pWinCtx->CritSect); 927 if (RT_SUCCESS(rc)) 919 SharedClipboardWinClose(); 920 /* Note: Clipboard must be closed first before calling OleSetClipboard(). */ 921 922 /** @todo There is a potential race between SharedClipboardWinClose() and OleSetClipboard(), 923 * where another application could own the clipboard (open), and thus the call to 924 * OleSetClipboard() will fail. Needs (better) fixing. */ 925 HRESULT hr = S_OK; 926 927 for (unsigned uTries = 0; uTries < 3; uTries++) 928 928 { 929 929 hr = OleSetClipboard(pWinURITransferCtx->pDataObj); … … 939 939 pWinCtx->hWndClipboardOwnerUs = GetClipboardOwner(); 940 940 941 rc = RTCritSectLeave(&pWinCtx->CritSect); 942 AssertRC(rc); 941 LogFlowFunc(("hWndClipboardOwnerUs=%p\n", pWinCtx->hWndClipboardOwnerUs)); 943 942 break; 944 943 } 944 945 LogFlowFunc(("Failed with %Rhrc (try %u/3)\n", hr, uTries + 1)); 946 RTThreadSleep(500); /* Wait a bit. */ 945 947 } 946 948 947 rc = RTCritSectLeave(&pWinCtx->CritSect); 948 AssertRCBreak(rc); 949 950 LogFlowFunc(("Failed with %Rhrc (try %u/3)\n", hr, uTries + 1)); 951 RTThreadSleep(500); /* Wait a bit. */ 952 } 953 954 if (FAILED(hr)) 955 { 956 rc = VERR_ACCESS_DENIED; /** @todo Fudge; fix this. */ 957 LogRel(("Shared Clipboard: Failed with %Rhrc when setting data object to clipboard\n", hr)); 949 if (FAILED(hr)) 950 { 951 rc = VERR_ACCESS_DENIED; /** @todo Fudge; fix this. */ 952 LogRel(("Shared Clipboard: Failed with %Rhrc when setting data object to clipboard\n", hr)); 953 } 958 954 } 959 955 } 956 else 957 rc = VERR_NO_MEMORY; 960 958 } 961 959 else 962 960 rc = VERR_NO_MEMORY; 963 } 964 else 965 rc = VERR_NO_MEMORY; 961 962 int rc2 = RTCritSectLeave(&pWinCtx->CritSect); 963 AssertRC(rc2); 964 } 966 965 967 966 LogFlowFuncLeaveRC(rc);
Note:
See TracChangeset
for help on using the changeset viewer.