[gtk+/gtk-3-22] linkbutton: Fix memory leak
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] linkbutton: Fix memory leak
- Date: Mon, 8 May 2017 14:10:26 +0000 (UTC)
commit 088cf9976384ccd369e9342e8fbbe210a0a3ab5f
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date: Fri May 5 10:52:27 2017 +0530
linkbutton: Fix memory leak
strings returned by gtk_widget_get_tooltip_text() and
gtk_widget_get_tooltip_markup() has to be freed when no longer
required.
https://bugzilla.gnome.org/show_bug.cgi?id=782202
gtk/gtklinkbutton.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c
index 1a7a0d6..0ce64a2 100644
--- a/gtk/gtklinkbutton.c
+++ b/gtk/gtklinkbutton.c
@@ -582,18 +582,24 @@ gtk_link_button_query_tooltip_cb (GtkWidget *widget,
{
GtkLinkButton *link_button = GTK_LINK_BUTTON (widget);
const gchar *label, *uri;
+ gchar *text, *markup;
label = gtk_button_get_label (GTK_BUTTON (link_button));
uri = link_button->priv->uri;
+ text = gtk_widget_get_tooltip_text (widget);
+ markup = gtk_widget_get_tooltip_markup (widget);
- if (!gtk_widget_get_tooltip_text (widget)
- && !gtk_widget_get_tooltip_markup (widget)
- && label && *label != '\0' && uri && strcmp (label, uri) != 0)
+ if (text == NULL &&
+ markup == NULL &&
+ label && *label != '\0' && uri && strcmp (label, uri) != 0)
{
gtk_tooltip_set_text (tooltip, uri);
return TRUE;
}
+ g_free (text);
+ g_free (markup);
+
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]