[at-spi2-core: 19/32] spi_dec_x11_mouse_check(): return early if there is no display




commit 6355b8b8084d925bf24cc42e029c77b153b9c446
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Dec 13 19:12:48 2021 -0600

    spi_dec_x11_mouse_check(): return early if there is no display
    
    Otherwise mask_return gets used with uninitialized data, since
    XQueryPointer() doesn't run.

 registryd/deviceeventcontroller-x11.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/registryd/deviceeventcontroller-x11.c b/registryd/deviceeventcontroller-x11.c
index 6060118b..65560480 100644
--- a/registryd/deviceeventcontroller-x11.c
+++ b/registryd/deviceeventcontroller-x11.c
@@ -383,11 +383,15 @@ spi_dec_x11_mouse_check (SpiDEController *controller,
   Window root_return, child_return;
   Display *display = spi_get_display ();
 
-  if (display != NULL)
-    XQueryPointer(display, DefaultRootWindow (display),
-                 &root_return, &child_return,
-                 x, y,
-                 &win_x_return, &win_y_return, &mask_return);
+  if (display == NULL)
+    {
+      return 0;
+    }
+
+  XQueryPointer(display, DefaultRootWindow (display),
+                &root_return, &child_return,
+                x, y,
+                &win_x_return, &win_y_return, &mask_return);
   /* 
    * Since many clients grab the pointer, and X goes an automatic
    * pointer grab on mouse-down, we often must detect mouse button events


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]