[gtk+/gtk-2-24] Entry: Fix leak of text in ensure_has_tooltip()



commit 111853d7dae79a0ccec6f9c62479354de240aca6
Author: Daniel Boles <dboles src gnome org>
Date:   Thu Sep 7 14:53:59 2017 +0100

    Entry: Fix leak of text in ensure_has_tooltip()
    
    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 |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 3623488..a566d8c 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -8367,7 +8367,8 @@ gtk_entry_get_icon_window (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)
     {
@@ -8385,6 +8386,10 @@ ensure_has_tooltip (GtkEntry *entry)
             }
         }
     }
+  else
+    {
+      g_free (text);
+    }
 
   gtk_widget_set_has_tooltip (GTK_WIDGET (entry), has_tooltip);
 }


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