diff options
Diffstat (limited to 'xorg-server/hw/xwin/winclipboardinit.c')
-rwxr-xr-x[-rw-r--r--] | xorg-server/hw/xwin/winclipboardinit.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/xorg-server/hw/xwin/winclipboardinit.c b/xorg-server/hw/xwin/winclipboardinit.c index 8aef8fe02..0ef49fa1a 100644..100755 --- a/xorg-server/hw/xwin/winclipboardinit.c +++ b/xorg-server/hw/xwin/winclipboardinit.c @@ -46,7 +46,7 @@ * Local variables */ -static pthread_t g_ptClipboardProc; +int winProcSetSelectionOwner(ClientPtr /* client */ ); /* * @@ -79,9 +79,6 @@ winClipboardThreadProc(void *arg) /* Print the display connection string */ ErrorF("winClipboardThreadProc - DISPLAY=%s\n", szDisplay); - /* Flag that clipboard client has been launched */ - g_fClipboardStarted = TRUE; - fShutdown = winClipboardProc(g_fUnicodeClipboard, szDisplay); /* Flag that clipboard client has stopped */ @@ -127,16 +124,21 @@ winInitClipboard(void) void winClipboardShutdown(void) { - /* Close down clipboard resources */ - if (g_fClipboard && g_fClipboardStarted) { - /* Synchronously destroy the clipboard window */ - winClipboardWindowDestroy(); - - /* Wait for the clipboard thread to exit */ - pthread_join(g_ptClipboardProc, NULL); - - g_fClipboardStarted = FALSE; - - winDebug("winClipboardShutdown - Clipboard thread has exited.\n"); - } + /* Close down clipboard resources */ + if (g_fClipboard && g_fClipboardLaunched && g_fClipboardStarted) { + /* Synchronously destroy the clipboard window */ + if (g_hwndClipboard != NULL) { + g_fClipboardStarted=FALSE; /* This is to avoid dead-locls caused by the clipboard thread still doing some stuff */ + SendMessage(g_hwndClipboard, WM_DESTROY, 0, 0); + /* NOTE: g_hwndClipboard is set to NULL in winclipboardthread.c */ + } + else + return; + + /* Wait for the clipboard thread to exit */ + pthread_join(g_ptClipboardProc, NULL); + + winDebug("winClipboardShutdown - Clipboard thread has exited.\n"); + } } + |