1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

winex11.drv: Lock display when expecting error events.

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>
This commit is contained in:
Zhiyi Zhang 2022-04-25 17:22:16 +08:00 committed by Alexandre Julliard
parent ed546bf190
commit 18ae96e5fb

View file

@ -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;
}