VirtualBox

Ignore:
Timestamp:
Feb 17, 2014 2:09:16 PM (11 years ago)
Author:
vboxsync
Message:

Additions/x11/VBoxClient: cleaned up clean-up in the drag and drop service.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp

    r50265 r50478  
    427427    virtual void cleanup(void)
    428428    {
    429         /* Cleanup */
    430         x11DragAndDropTerm();
     429        /* Nothing to do, everything should be cleaned up automatically when the
     430         * user process/X11 client exits. */
    431431    };
    432432
    433433private:
    434434    int x11DragAndDropInit(void);
    435     int x11DragAndDropTerm(void);
    436435    static int hgcmEventThread(RTTHREAD hThread, void *pvUser);
    437436    static int x11EventThread(RTTHREAD hThread, void *pvUser);
     
    17651764    } while (0);
    17661765
    1767     /* Cleanup on failure */
    1768     if (RT_FAILURE(rc))
    1769         x11DragAndDropTerm();
     1766    /* No clean-up code for now, as we have no good way of testing it and things
     1767     * should get cleaned up when the user process/X11 client exits. */
    17701768
    17711769    return rc;
    1772 }
    1773 
    1774 int DragAndDropService::x11DragAndDropTerm(void)
    1775 {
    1776     /* Mark that we are stopping. */
    1777     ASMAtomicWriteBool(&m_fSrvStopping, true);
    1778     RTSemEventSignal(m_hEventSem);
    1779 
    1780     if (m_pDisplay)
    1781     {
    1782         /* Send a x11 client messages to the x11 event loop. */
    1783         XClientMessageEvent m;
    1784         RT_ZERO(m);
    1785         m.type         = ClientMessage;
    1786         m.display      = m_pDisplay;
    1787         m.window       = None;
    1788         m.message_type = xAtom(XA_dndstop);
    1789         m.format       = 32;
    1790         int xrc = XSendEvent(m_pDisplay, None, True, NoEventMask, reinterpret_cast<XEvent*>(&m));
    1791         if (RT_UNLIKELY(xrc == 0))
    1792             LogFlowThisFunc(("Error sending xevent\n"));
    1793     }
    1794 
    1795     /* We cannot signal the m_hHGCMThread as it is most likely waiting in vbglR3DoIOCtl() */
    1796     /** @todo r=michael Don't we have a mechanism for cancelling HGCM calls
    1797      *                  though? */
    1798     /* Wait for our event threads to stop. */
    1799     /** @todo r=michael This routine is generally called on the X11 thread,
    1800      *                  protected by a mutex, so the following thread wait
    1801      *                  makes us hang forever. */
    1802     if (m_hX11Thread)
    1803         RTThreadWait(m_hX11Thread, RT_INDEFINITE_WAIT, NULL);
    1804     /* Cleanup */
    1805     /* todo: This doesn't work. The semaphore was interrupted by the user
    1806      * signal. It is not possible to destroy a semaphore while it is in interrupted state.
    1807      * According to Frank, the cleanup stuff done here is done _wrong_. We just
    1808      * should signal the main loop to stop and do the cleanup there. Needs
    1809      * adoption in all VBoxClient::Service's. */
    1810 //    if (m_hEventSem)
    1811 //        RTSemEventDestroy(m_hEventSem);
    1812     if (m_pDisplay)
    1813         XCloseDisplay(m_pDisplay);
    1814     return VINF_SUCCESS;
    18151770}
    18161771
     
    18861841            e.type = DnDEvent::X11_Type;
    18871842            XNextEvent(pThis->m_pDisplay, &e.x11);
    1888 #if 0
    1889             /* We never detect the stop event here for some reason */
    1890             /* Check for a stop message. */
    1891             if (   e.x11.type == ClientMessage
    1892                 && e.x11.xclient.message_type == xAtom(XA_dndstop))
    1893                 break;
    1894 #endif
    1895 //            if (isDnDRespondEvent(pThis->m_pDisplay, &e.x11, 0))
    18961843            {
    18971844                /* Appending makes a copy of the event structure. */
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