From: Zhiyi Zhang zzhang@codeweavers.com
If the display is not locked, another thread could take the error event and handle it with the default error handlers and thus not handled by the current thread with the specified error handlers.
Fix Cladun X2 crash at start.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/winex11.drv/x11drv_main.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index cd2ea87190a..4fe450237d3 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -273,6 +273,7 @@ static inline BOOL ignore_error( Display *display, XErrorEvent *event ) void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg ) { pthread_mutex_lock( &error_mutex ); + XLockDisplay( display ); err_callback = callback; err_callback_display = display; err_callback_arg = arg; @@ -291,6 +292,7 @@ int X11DRV_check_error(void) { int res = err_callback_result; err_callback = NULL; + XUnlockDisplay( err_callback_display ); pthread_mutex_unlock( &error_mutex ); return res; }