[gtk+] Entry: Fix leak of text in ensure_has_tooltip()



commit 09d1d5a0d6dd9a4c5e0a137a92e9fa38b7ad36dd
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 e2f22dc..7c5673c 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -8127,7 +8127,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)
     {
@@ -8145,6 +8146,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]