forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
3d21128dbb
commit
00cd92ea71
@ -599,18 +599,24 @@ gtk_link_button_query_tooltip_cb (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkLinkButton *link_button = GTK_LINK_BUTTON (widget);
|
GtkLinkButton *link_button = GTK_LINK_BUTTON (widget);
|
||||||
const gchar *label, *uri;
|
const gchar *label, *uri;
|
||||||
|
gchar *text, *markup;
|
||||||
|
|
||||||
label = gtk_button_get_label (GTK_BUTTON (link_button));
|
label = gtk_button_get_label (GTK_BUTTON (link_button));
|
||||||
uri = link_button->priv->uri;
|
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)
|
if (text == NULL &&
|
||||||
&& !gtk_widget_get_tooltip_markup (widget)
|
markup == NULL &&
|
||||||
&& label && *label != '\0' && uri && strcmp (label, uri) != 0)
|
label && *label != '\0' && uri && strcmp (label, uri) != 0)
|
||||||
{
|
{
|
||||||
gtk_tooltip_set_text (tooltip, uri);
|
gtk_tooltip_set_text (tooltip, uri);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (text);
|
||||||
|
g_free (markup);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user