VirtualBox

Changeset 86869 in vbox for trunk/src


Ignore:
Timestamp:
Nov 12, 2020 7:59:52 AM (4 years ago)
Author:
vboxsync
Message:

DnD: Termination fixes / clarification.

Location:
trunk/src/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.cpp

    r85746 r86869  
    610610                }
    611611
     612                case VBGLR3DNDEVENTTYPE_QUIT:
     613                {
     614                    LogRel(("DnD: Received quit message, shutting down ...\n"));
     615                    PostQuitMessage(0);
     616                }
     617
    612618#ifdef VBOX_WITH_DRAG_AND_DROP_GH
    613619                case VBGLR3DNDEVENTTYPE_GH_ERROR:
     
    18771883                LogRel(("DnD: Processing proxy window event %RU32 failed with %Rrc\n", pVbglR3Event->enmType, rc));
    18781884        }
    1879         else if (rc == VERR_INTERRUPTED) /* Disconnected from service. */
    1880         {
    1881             LogRel(("DnD: Received quit message, shutting down ...\n"));
    1882             pWnd->PostMessage(WM_QUIT, 0 /* wParm */, 0 /* lParm */);
    1883             rc = VINF_SUCCESS;
    1884         }
    18851885
    18861886        if (RT_FAILURE(rc))
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDragAndDrop.cpp

    r85746 r86869  
    6161 *
    6262 * @returns IPRT status code.
     63 *          Will return VERR_CANCELLED (implemented by the host service) if we need to bail out.
    6364 * @param   pCtx                DnD context to use.
    6465 * @param   puMsg               Where to store the message type.
     
    7273    AssertPtrReturn(pcParms, VERR_INVALID_POINTER);
    7374
    74     HGCMMsgGetNext Msg;
    75     VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, GUEST_DND_FN_GET_NEXT_HOST_MSG, 3);
    76     Msg.uMsg.SetUInt32(0);
    77     Msg.cParms.SetUInt32(0);
    78     Msg.fBlock.SetUInt32(fWait ? 1 : 0);
    79 
    80     int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
    81     if (RT_SUCCESS(rc))
    82     {
    83         rc = Msg.uMsg.GetUInt32(puMsg);     AssertRC(rc);
    84         rc = Msg.cParms.GetUInt32(pcParms); AssertRC(rc);
    85     }
     75    int rc;
     76
     77    do
     78    {
     79        HGCMMsgGetNext Msg;
     80        VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, GUEST_DND_FN_GET_NEXT_HOST_MSG, 3);
     81        Msg.uMsg.SetUInt32(0);
     82        Msg.cParms.SetUInt32(0);
     83        Msg.fBlock.SetUInt32(fWait ? 1 : 0);
     84
     85        rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
     86        if (RT_SUCCESS(rc))
     87        {
     88            rc = Msg.uMsg.GetUInt32(puMsg);     AssertRC(rc);
     89            rc = Msg.cParms.GetUInt32(pcParms); AssertRC(rc);
     90        }
     91
     92    } while (rc == VERR_INTERRUPTED);
    8693
    8794    return rc;
     
    10781085{
    10791086    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     1087
     1088    if (!pCtx->uClientID) /* Already disconnected? Bail out early. */
     1089        return VINF_SUCCESS;
     1090
    10801091    int rc = VbglR3HGCMDisconnect(pCtx->uClientID);
    10811092    if (RT_SUCCESS(rc))
    10821093        pCtx->uClientID = 0;
     1094
    10831095    return rc;
    10841096}
     
    11621174                rc = VbglR3DnDConnect(pCtx);
    11631175        }
     1176    }
     1177
     1178    if (rc == VERR_CANCELLED) /* Host service told us that we have to bail out. */
     1179    {
     1180        pEvent->enmType = VBGLR3DNDEVENTTYPE_QUIT;
     1181
     1182        *ppEvent = pEvent;
     1183
     1184        return VINF_SUCCESS;
    11641185    }
    11651186
  • trunk/src/VBox/HostServices/DragAndDrop/VBoxDragAndDropSvc.cpp

    r85749 r86869  
    147147void DragAndDropClient::disconnect(void) RT_NOEXCEPT
    148148{
    149     LogFlowThisFunc(("uClient=%RU32\n", m_idClient));
    150 
     149    LogFlowThisFunc(("uClient=%RU32, fDeferred=%RTbool\n", m_idClient, IsDeferred()));
     150
     151    /*
     152     * If the client still is waiting for a message (i.e in deferred mode),
     153     * complete the call with a VERR_CANCELED status so that the client (VBoxTray / VBoxClient) knows
     154     * it should bail out.
     155     */
    151156    if (IsDeferred())
    152         CompleteDeferred(VERR_INTERRUPTED);
     157        CompleteDeferred(VERR_CANCELLED);
    153158
    154159    /*
     
    471476            break;
    472477    }
    473 
    474 #ifdef DEBUG_andy
    475     LogFlowFunc(("Mode (%RU32) check rc=%Rrc\n", modeGet(), rc));
    476 #endif
    477478
    478479#define DO_HOST_CALLBACK();                                                                   \
     
    10281029    if (rc == VINF_HGCM_ASYNC_EXECUTE)
    10291030    {
     1031        LogFlowFunc(("Deferring client %RU32\n", idClient));
     1032
    10301033        try
    10311034        {
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