GdkCursor: Don't leak a cairo surface

The function gdk_cursor_new_from_pixbuf creates a cairo surface
to pass to its backend implementation, but doesn't destroy it
afterwards.
https://bugzilla.gnome.org/show_bug.cgi?id=729670
This commit is contained in:
David Mansfield 2014-05-06 18:50:00 +00:00 committed by Matthias Clasen
parent 74405cc964
commit 00275dfc9f

View File

@ -318,6 +318,7 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
const char *option;
char *end;
gint64 value;
GdkCursor *cursor;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
@ -346,7 +347,11 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_surface (display, surface, x, y);
cursor = GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_surface (display, surface, x, y);
cairo_surface_destroy (surface);
return cursor;
}
/**