[gtk: 1/2] Fix some leaks



commit 06661da8b014e35ea3b20f73c144773ac95b700b
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Tue Mar 27 13:14:41 2018 +0200

    Fix some leaks

 gtk/gtkcolorbutton.c | 1 +
 gtk/gtkcolorswatch.c | 1 +
 gtk/gtkiconhelper.c  | 7 ++++++-
 3 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index 4ef68a1875..084105a0f4 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -334,6 +334,7 @@ set_color_icon (GdkDragContext *context,
   paintable = gtk_snapshot_free_to_paintable (snapshot);
 
   gtk_drag_set_icon_paintable (context, paintable, 0, 0);
+  g_object_unref (paintable);
 }
 
 static void
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index a40b334c0e..5f4a8eeb41 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -178,6 +178,7 @@ drag_set_color_icon (GdkDragContext *context,
   paintable = gtk_snapshot_free_to_paintable (snapshot);
 
   gtk_drag_set_icon_paintable (context, paintable, 4, 4);
+  g_object_unref (paintable);
 }
 
 static void
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index e182836833..ca7e308870 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -136,7 +136,12 @@ ensure_paintable_for_gicon (GtkIconHelper    *self,
   *symbolic = gtk_icon_info_is_symbolic (info);
   paintable = GDK_PAINTABLE (gtk_icon_info_load_texture (info));
   if (paintable && scale != 1)
-    paintable = gtk_scaler_new (paintable, scale);
+    {
+      GdkPaintable *orig = paintable;
+
+      paintable = gtk_scaler_new (orig, scale);
+      g_object_unref (orig);
+    }
 
   return paintable;
 }


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