[gtk] wayland: Allow a NULL inhibitors hash table



commit fc57d3b5a33504a43b5e5877a69b193ebdb240eb
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Apr 23 10:57:07 2018 +0100

    wayland: Allow a NULL inhibitors hash table
    
    The shortcuts inhibitors hash table is created when we create a
    GdkWaylandWindow implementation for a GdkWindow, and it's destroyed once
    we finalize the instance. The fake "root" window we create for the
    Wayland display does not have a backing native window, so the shortcuts
    inhibitors hash table is set to NULL; this causes a critical error
    message when calling g_hash_table_destroy() on it. The finalization of
    the root window happens when we close a display connection.
    
    We should use g_clear_pointer(), instead, as it's NULL safe.
    
    Without this change, the displayclose test fails, as all warnings are
    considered fatal.

 gdk/wayland/gdksurface-wayland.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index e64cba366b..7823589938 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -914,8 +914,7 @@ gdk_surface_impl_wayland_finalize (GObject *object)
   g_clear_pointer (&impl->opaque_region, cairo_region_destroy);
   g_clear_pointer (&impl->input_region, cairo_region_destroy);
   g_clear_pointer (&impl->staged_updates_region, cairo_region_destroy);
-
-  g_hash_table_destroy (impl->shortcuts_inhibitors);
+  g_clear_pointer (&impl->shortcuts_inhibitors, g_hash_table_unref);
 
   G_OBJECT_CLASS (_gdk_surface_impl_wayland_parent_class)->finalize (object);
 }


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