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:
parent
5819a02d46
commit
7ca9330194
|
@ -113,6 +113,7 @@ winClipboardProc(Bool fUseUnicode, char *szDisplay)
|
||||||
Window iWindow = None;
|
Window iWindow = None;
|
||||||
int iSelectError;
|
int iSelectError;
|
||||||
Bool fShutdown = FALSE;
|
Bool fShutdown = FALSE;
|
||||||
|
static Bool fErrorHandlerSet = FALSE;
|
||||||
|
|
||||||
winDebug("winClipboardProc - Hello\n");
|
winDebug("winClipboardProc - Hello\n");
|
||||||
|
|
||||||
|
@ -127,11 +128,15 @@ winClipboardProc(Bool fUseUnicode, char *szDisplay)
|
||||||
ErrorF("winClipboardProc - Warning: Locale not supported by X.\n");
|
ErrorF("winClipboardProc - Warning: Locale not supported by X.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set error handler */
|
|
||||||
XSetErrorHandler(winClipboardErrorHandler);
|
|
||||||
g_winClipboardProcThread = pthread_self();
|
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 */
|
/* Set jump point for Error exits */
|
||||||
if (setjmp(g_jmpEntry)) {
|
if (setjmp(g_jmpEntry)) {
|
||||||
|
|
Loading…
Reference in New Issue