Zhiyi Zhang : winex11.drv: Don't compare error event serial if it's zero.

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


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

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue May 17 16:45:58 2022 +0800

winex11.drv: Don't compare error event serial if it's zero.

Sometimes error event serial is zero. For example, NVIDIA driver may send X_GLXCopyContext errors
with the event serial set to zero. When it's zero, previously the error handler passes the error
to the default error handler and cause application crashes.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>

---

 dlls/winex11.drv/x11drv_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 4fe450237d3..44d4763b316 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -304,7 +304,7 @@ int X11DRV_check_error(void)
 static int error_handler( Display *display, XErrorEvent *error_evt )
 {
     if (err_callback && display == err_callback_display &&
-        (long)(error_evt->serial - err_serial) >= 0)
+        (!error_evt->serial || error_evt->serial >= err_serial))
     {
         if ((err_callback_result = err_callback( display, error_evt, err_callback_arg )))
         {




More information about the wine-cvs mailing list