[gtk/wip/otte/gl-hdr: 3/5] surface: Use g_clear_thing()




commit 064990266b4921bbee2cb7652f25ed080abe3bac
Author: Benjamin Otte <otte redhat com>
Date:   Fri Sep 24 19:43:15 2021 +0200

    surface: Use g_clear_thing()

 gdk/gdksurface.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index d2031eaf8f..53c98c9158 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -710,22 +710,14 @@ gdk_surface_finalize (GObject *object)
       _gdk_surface_destroy (surface, FALSE);
     }
 
-  if (surface->input_region)
-    cairo_region_destroy (surface->input_region);
-
-  if (surface->cursor)
-    g_object_unref (surface->cursor);
-
-  if (surface->device_cursor)
-    g_hash_table_destroy (surface->device_cursor);
-
-  if (surface->devices_inside)
-    g_list_free (surface->devices_inside);
+  g_clear_pointer (&surface->input_region, cairo_region_destroy);
+  g_clear_object (&surface->cursor);
+  g_clear_pointer (&surface->device_cursor, g_hash_table_destroy);
+  g_clear_pointer (&surface->devices_inside, g_list_free);
 
   g_clear_object (&surface->display);
 
-  if (surface->opaque_region)
-    cairo_region_destroy (surface->opaque_region);
+  g_clear_pointer (&surface->opaque_region, cairo_region_destroy);
 
   if (surface->parent)
     surface->parent->children = g_list_remove (surface->parent->children, surface);


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