Changeset 63471 in vbox for trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
- Timestamp:
- Aug 15, 2016 12:23:46 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
r63252 r63471 584 584 585 585 Assert(pThis->mDataBase.m_cTransfersPending); 586 pThis->mDataBase.m_cTransfersPending--; 586 if (pThis->mDataBase.m_cTransfersPending) 587 pThis->mDataBase.m_cTransfersPending--; 587 588 588 589 LogFlowFunc(("pTarget=%p vrc=%Rrc (ignored)\n", (GuestDnDTarget *)pThis, vrc)); … … 631 632 SendDataTask *pTask = NULL; 632 633 PSENDDATACTX pSendCtx = NULL; 633 RTTHREAD rcThreadSend;634 int rc = S_OK;635 634 636 635 try … … 655 654 } 656 655 657 //this function delete pTask in case of exceptions, so there is no need in the call of delete operator 658 //pSendCtx is deleted in the pTask destructor 659 /** @todo r=bird: The code using hThreadSend is racing the thread termination. Since the thread isn't 660 * created waitable, the handle goes away if we it terminates before our RTThreadUserWait call returns. */ 661 hr = pTask->createThreadWithRaceCondition(&rcThreadSend); 656 /* This function delete pTask in case of exceptions, 657 * so there is no need in the call of delete operator. */ 658 hr = pTask->createThreadWithType(RTTHREADTYPE_MAIN_WORKER); 662 659 663 660 } … … 665 662 { 666 663 hr = setError(E_OUTOFMEMORY); 667 rcThreadSend = NIL_RTTHREAD;668 664 } 669 665 catch (...) 670 666 { 671 LogRel2(("DnD: Could not create thread for SendDataTask\n"));667 LogRel2(("DnD: Could not create thread for data sending task\n")); 672 668 hr = E_FAIL; 673 rcThreadSend = NIL_RTTHREAD;674 669 } 675 670 676 671 if (SUCCEEDED(hr)) 677 672 { 678 rc = RTThreadUserWait(rcThreadSend, 30 * 1000 /* 30s timeout */); 679 if (RT_SUCCESS(rc)) 680 { 681 mDataBase.m_cTransfersPending++; 682 683 hr = pResp->queryProgressTo(aProgress.asOutParam()); 684 ComAssertComRC(hr); 685 686 /* Note: pTask is now owned by the worker thread. */ 687 } 688 else 689 hr = setError(VBOX_E_IPRT_ERROR, tr("Waiting for sending thread failed (%Rrc)"), rc); 673 mDataBase.m_cTransfersPending++; 674 675 hr = pResp->queryProgressTo(aProgress.asOutParam()); 676 ComAssertComRC(hr); 677 678 /* Note: pTask is now owned by the worker thread. */ 690 679 } 691 680 else 692 hr = setError(VBOX_E_IPRT_ERROR, tr("Starting thread for GuestDnDTarget::i_sendDataThread (%R rc)"), rc);681 hr = setError(VBOX_E_IPRT_ERROR, tr("Starting thread for GuestDnDTarget::i_sendDataThread (%Rhrc)"), hr); 693 682 694 683 LogFlowFunc(("Returning hr=%Rhrc\n", hr));
Note:
See TracChangeset
for help on using the changeset viewer.