summaryrefslogtreecommitdiff
path: root/gtk/gtktexthandle.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2016-11-23 13:55:28 -0500
committerMatthias Clasen <mclasen@redhat.com>2016-11-23 13:57:03 -0500
commit0e37d6739393cfe2da99e6331dc981780acf96e1 (patch)
tree9249f08fe5f16950a3b1bc836a7be74e8cad9535 /gtk/gtktexthandle.c
parent0cb35bf394b6c9eb76790d7bf01709c6668f7b48 (diff)
downloadgtk+-0e37d6739393cfe2da99e6331dc981780acf96e1.tar.gz
text handle: Don't leak adjustments
This can happen if the weak pointer is triggered before the adjustments are unset. Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=774790
Diffstat (limited to 'gtk/gtktexthandle.c')
-rw-r--r--gtk/gtktexthandle.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 19e89f1d1a..04373fe70b 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -458,25 +458,21 @@ _gtk_text_handle_set_scrollable (GtkTextHandle *handle,
priv = handle->priv;
- if (priv->parent_scrollable)
+ if (priv->vadj)
{
- if (priv->vadj)
- {
- g_signal_handlers_disconnect_by_data (priv->vadj, handle);
- g_object_unref (priv->vadj);
- priv->vadj = NULL;
- }
+ g_signal_handlers_disconnect_by_data (priv->vadj, handle);
+ g_clear_object (&priv->vadj);
+ }
- if (priv->hadj)
- {
- g_signal_handlers_disconnect_by_data (priv->hadj, handle);
- g_object_unref (priv->hadj);
- priv->hadj = NULL;
- }
-
- g_object_remove_weak_pointer (G_OBJECT (priv->parent_scrollable), (gpointer *) &priv->parent_scrollable);
+ if (priv->hadj)
+ {
+ g_signal_handlers_disconnect_by_data (priv->hadj, handle);
+ g_clear_object (&priv->hadj);
}
+ if (priv->parent_scrollable)
+ g_object_remove_weak_pointer (G_OBJECT (priv->parent_scrollable), (gpointer *) &priv->parent_scrollable);
+
priv->parent_scrollable = scrollable;
if (scrollable)