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
This commit is contained in:
Ray Strode
2016-02-02 20:43:12 -05:00
parent e6f92df57e
commit 1cfa2f4134

View File

@@ -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