Entry: Fix leak of text in ensure_has_tooltip()
authorDaniel Boles <dboles@src.gnome.org>
Thu, 7 Sep 2017 13:53:59 +0000 (14:53 +0100)
committerDaniel Boles <dboles@src.gnome.org>
Thu, 7 Sep 2017 13:54:14 +0000 (14:54 +0100)
Thanks to Mohammed Sadiq for noticing this. I guess I got
Widget.get_tooltip_text() confused with Label.get_label().

https://bugzilla.gnome.org/show_bug.cgi?id=787410

gtk/gtkentry.c

index 2ee69315bbef6f9c51aa3ced26e9138a97c214e1..d97b6e97c312b5a11d750a633e931918682fdd1a 100644 (file)
@@ -9192,7 +9192,8 @@ gtk_entry_get_icon_area (GtkEntry             *entry,
 static void
 ensure_has_tooltip (GtkEntry *entry)
 {
-  gboolean has_tooltip = gtk_widget_get_tooltip_text (GTK_WIDGET (entry)) != NULL;
+  gchar *text = gtk_widget_get_tooltip_text (GTK_WIDGET (entry));
+  gboolean has_tooltip = text != NULL;
 
   if (!has_tooltip)
     {
@@ -9210,6 +9211,10 @@ ensure_has_tooltip (GtkEntry *entry)
             }
         }
     }
+  else
+    {
+      g_free (text);
+    }
 
   gtk_widget_set_has_tooltip (GTK_WIDGET (entry), has_tooltip);
 }