[gtk+/gtk-3-10] GdkCursor: Don't leak a cairo surface



commit dc98a26aa24997d85694f19045953fa69c42596c
Author: David Mansfield <gnome-bugzilla dm cobite com>
Date:   Tue May 6 18:50:00 2014 +0000

    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

 gdk/gdkcursor.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gdk/gdkcursor.c b/gdk/gdkcursor.c
index 7d4e453..8070306 100644
--- a/gdk/gdkcursor.c
+++ b/gdk/gdkcursor.c
@@ -356,6 +356,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);
@@ -384,7 +385,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;
 }
 
 /**


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