[gtk+: 4/8] wayland: use g_clear_pointer when destroying cairo surfaces



commit 1cfa2f41345d37c6efba30796cedf3817f396b8e
Author: Ray Strode <rstrode redhat com>
Date:   Tue Feb 2 20:43:12 2016 -0500

    wayland: use g_clear_pointer when destroying cairo surfaces
    
    There are a few places where we destroy a cairo surface and
    then nullify it. This commit changes those to use
    g_clear_pointer instead.
    
    It also drops a cairo_surface_finish call that is unnecessary
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761312

 gdk/wayland/gdkwindow-wayland.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index c349fd5..f5a0546 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -208,11 +208,7 @@ gdk_wayland_window_update_size (GdkWindow *window,
   GdkRectangle area;
   cairo_region_t *region;
 
-  if (impl->cairo_surface)
-    {
-      cairo_surface_destroy (impl->cairo_surface);
-      impl->cairo_surface = NULL;
-    }
+  g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
 
   window->width = width;
   window->height = height;
@@ -1849,12 +1845,7 @@ gdk_wayland_window_destroy (GdkWindow *window,
 
   gdk_wayland_window_hide_surface (window);
 
-  if (impl->cairo_surface)
-    {
-      cairo_surface_finish (impl->cairo_surface);
-      cairo_surface_destroy (impl->cairo_surface);
-      impl->cairo_surface = NULL;
-    }
+  g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
 }
 
 static void


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