Zhiyi Zhang : winex11.drv: Lock display when expecting error events.

Alexandre Julliard julliard at winehq.org
Wed Jul 13 16:56:07 CDT 2022


Module: wine
Branch: master
Commit: 18ae96e5fb3cbbd53f1a022ba81203de6b431228
URL:    https://gitlab.winehq.org/wine/wine/-/commit/18ae96e5fb3cbbd53f1a022ba81203de6b431228

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Mon Apr 25 17:22:16 2022 +0800

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




More information about the wine-cvs mailing list