diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2013-06-18 19:53:52 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2014-01-04 16:15:48 +0000 |
commit | 4031a2b66bb66464f46d0e88f3bf9a495ef8de9c (patch) | |
tree | adab25bf202418825de8245ece140ab4d9392ef0 | |
parent | d4a9823d897abfbcf3fa1b82b4ceab6298f44553 (diff) |
Only add to XSetIOErrorHandler() handler chain once
Only use XSetIOErrorHandler() to add to the global XSetIOErrorHandler() chain
once. If we do it every restart, then we make a loop in the handler chain, and
we end up with a thread spinning in that loop when the server shuts down...
-rw-r--r-- | hw/xwin/winclipboard/thread.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/hw/xwin/winclipboard/thread.c b/hw/xwin/winclipboard/thread.c index 3b02d2a2f..f60a3e94c 100644 --- a/hw/xwin/winclipboard/thread.c +++ b/hw/xwin/winclipboard/thread.c @@ -117,10 +117,16 @@ winClipboardProc(Bool fUseUnicode, char *szDisplay) winDebug("winClipboardProc - Hello\n"); /* Set error handler */ - XSetErrorHandler(winClipboardErrorHandler); + static Bool fErrorHandlerSet = FALSE; + g_winClipboardProcThread = pthread_self(); - g_winClipboardOldIOErrorHandler = - XSetIOErrorHandler(winClipboardIOErrorHandler); + + if (! fErrorHandlerSet) { + XSetErrorHandler(winClipboardErrorHandler); + g_winClipboardOldIOErrorHandler = + XSetIOErrorHandler(winClipboardIOErrorHandler); + fErrorHandlerSet = TRUE; + } /* Set jump point for Error exits */ if (setjmp(g_jmpEntry)) { |