hw/xwin: 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...

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2013-06-18 19:53:52 +01:00
parent 5819a02d46
commit 7ca9330194

View File

@ -113,6 +113,7 @@ winClipboardProc(Bool fUseUnicode, char *szDisplay)
Window iWindow = None;
int iSelectError;
Bool fShutdown = FALSE;
static Bool fErrorHandlerSet = FALSE;
winDebug("winClipboardProc - Hello\n");
@ -127,11 +128,15 @@ winClipboardProc(Bool fUseUnicode, char *szDisplay)
ErrorF("winClipboardProc - Warning: Locale not supported by X.\n");
}
/* Set error handler */
XSetErrorHandler(winClipboardErrorHandler);
g_winClipboardProcThread = pthread_self();
g_winClipboardOldIOErrorHandler =
XSetIOErrorHandler(winClipboardIOErrorHandler);
/* Set error handler */
if (!fErrorHandlerSet) {
XSetErrorHandler(winClipboardErrorHandler);
g_winClipboardOldIOErrorHandler =
XSetIOErrorHandler(winClipboardIOErrorHandler);
fErrorHandlerSet = TRUE;
}
/* Set jump point for Error exits */
if (setjmp(g_jmpEntry)) {