wayland: port code to g_clear_pointer
authorDavid Edmundson <davidedmundson@kde.org>
Fri, 1 Oct 2021 12:31:39 +0000 (13:31 +0100)
committerDavid Edmundson <davidedmundson@kde.org>
Fri, 15 Oct 2021 11:03:57 +0000 (12:03 +0100)
gdk/wayland/gdkdisplay-wayland.c
gdk/wayland/gdksurface-wayland.c

index 4f70a3c833c428300b3e24ee3da7c581e20a0faf..4a547b80a6a26993396e4c04a8e2c4e7d9fc4ced 100644 (file)
@@ -697,11 +697,7 @@ gdk_wayland_display_finalize (GObject *object)
   g_free (display_wayland->cursor_theme_name);
   xkb_context_unref (display_wayland->xkb_context);
 
-  if (display_wayland->cursor_theme)
-    {
-      wl_cursor_theme_destroy (display_wayland->cursor_theme);
-      display_wayland->cursor_theme = NULL;
-    }
+  g_clear_pointer (&display_wayland->cursor_theme, wl_cursor_theme_destroy);
 
   g_list_store_remove_all (display_wayland->monitors);
   g_object_unref (display_wayland->monitors);
index 53abdc230200f065c9ce9140beef1fecc0e46852..11dcf6e2bd453c5799655da16ab5998319bc8097 100644 (file)
@@ -2303,10 +2303,7 @@ gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel)
   g_assert (impl->idle_inhibitor && impl->idle_inhibitor_refcount > 0);
 
   if (--impl->idle_inhibitor_refcount == 0)
-    {
-      zwp_idle_inhibitor_v1_destroy (impl->idle_inhibitor);
-      impl->idle_inhibitor = NULL;
-    }
+    g_clear_pointer (&impl->idle_inhibitor, zwp_idle_inhibitor_v1_destroy);
 }
 
 static void