VirtualBox

Changeset 18708 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Apr 3, 2009 5:55:59 PM (16 years ago)
Author:
vboxsync
Message:

GuestHost/SharedClipboard: reorganise constructor and destructor funcions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/x11-clipboard.cpp

    r18633 r18708  
    164164    RTSemEventCreate(&g_ctxHost.waitForData);
    165165    RTSemMutexCreate(&g_ctxHost.clipboardMutex);
    166     rc = VBoxX11ClipboardInitX11(&g_ctxHost, &pBackend);
    167     if (RT_FAILURE(rc))
     166    pBackend = VBoxX11ClipboardConstructX11(&g_ctxHost);
     167    if (pBackend == NULL)
    168168    {
    169169        RTSemEventDestroy(g_ctxHost.waitForData);
    170170        RTSemMutexDestroy(g_ctxHost.clipboardMutex);
    171         LogRel(("Failed to start the host shared clipboard service.\n"));
     171        LogRel(("Failed to start the host shared clipboard service, out of memory.\n"));
     172        rc = VERR_NO_MEMORY;
    172173    }
    173174    else
     
    198199     *         even if we are not waiting. */
    199200    RTSemEventSignal(g_ctxHost.waitForData);
    200     rc = VBoxX11ClipboardTermX11(g_ctxHost.pBackend);
    201     if (RT_SUCCESS(rc))
    202     {
    203         /* We can safely destroy these as the backend has exited
    204          * successfully and no other calls from the host code should be
    205          * forthcoming. */
    206         /** @todo  can the backend fail to exit successfully?  What then? */
    207         RTSemEventDestroy(g_ctxHost.waitForData);
    208         RTSemMutexDestroy(g_ctxHost.clipboardMutex);
    209     }
     201    VBoxX11ClipboardDestructX11(g_ctxHost.pBackend);
     202    /* We can safely destroy these as the backend has exited
     203     * successfully and no other calls from the host code should be
     204     * forthcoming. */
     205    RTSemEventDestroy(g_ctxHost.waitForData);
     206    RTSemMutexDestroy(g_ctxHost.clipboardMutex);
    210207}
    211208
     
    227224     * client at a time. */
    228225    rc = VBoxX11ClipboardStartX11(g_ctxHost.pBackend,
    229                                   X11 /* initial owner */);
     226                                  true /* fOwnClipboard */);
    230227    return rc;
    231228}
     
    263260    RTSemMutexRequest(g_ctxHost.clipboardMutex, RT_INDEFINITE_WAIT);
    264261    g_ctxHost.pClient = NULL;
    265     VBoxX11ClipboardStopX11(g_ctxHost.pBackend);
     262    /** @todo handle this slightly more reasonably, or be really sure
     263     *        it won't go wrong. */
     264    AssertRC(VBoxX11ClipboardStopX11(g_ctxHost.pBackend));
    266265    RTSemMutexRelease(g_ctxHost.clipboardMutex);
    267266}
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