[gtk/gtk-3-24: 17/20] Fix crash if there are no grabs in place.



commit 5294c4f6f33c8071d9c948752c4e3bd728746890
Author: John Ralls <jralls ceridwen us>
Date:   Mon Nov 26 09:51:36 2018 +0900

    Fix crash if there are no grabs in place.

 gdk/gdkdisplay.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 40225e92ac..1845e80de3 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -1318,6 +1318,11 @@ _gdk_display_check_grab_ownership (GdkDisplay *display,
   GdkGrabOwnership higher_ownership, device_ownership;
   gboolean device_is_keyboard;
 
+  g_return_val_if_fail (display, TRUE);
+
+  if (!display->device_grabs)
+    return TRUE; /* No hash table, no grabs. */
+
   g_hash_table_iter_init (&iter, display->device_grabs);
   higher_ownership = device_ownership = GDK_OWNERSHIP_NONE;
   device_is_keyboard = (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD);


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