summaryrefslogtreecommitdiff
path: root/gtk/gtkmountoperation.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-02-03 21:00:17 -0500
committerMatthias Clasen <mclasen@redhat.com>2014-02-03 21:00:17 -0500
commit05f2f634260519b5448ffd53e8883412c0251443 (patch)
tree292f44fdf8d6b8cb91a6e539d608e76c9efa85ac /gtk/gtkmountoperation.c
parentcc517f116adb9dfe424994c11933a98da111da5e (diff)
downloadgtk+-05f2f634260519b5448ffd53e8883412c0251443.tar.gz
GtkMountOperation: Clean up a dangling signal handler
Based on a patch by Eugene Shatokhin, https://bugzilla.gnome.org/show_bug.cgi?id=723366
Diffstat (limited to 'gtk/gtkmountoperation.c')
-rw-r--r--gtk/gtkmountoperation.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c
index 6016a1b68c..0ac9c2a7aa 100644
--- a/gtk/gtkmountoperation.c
+++ b/gtk/gtkmountoperation.c
@@ -212,7 +212,12 @@ gtk_mount_operation_finalize (GObject *object)
g_list_free (priv->user_widgets);
if (priv->parent_window)
- g_object_unref (priv->parent_window);
+ {
+ g_signal_handlers_disconnect_by_func (priv->parent_window,
+ gtk_widget_destroyed,
+ &priv->parent_window);
+ g_object_unref (priv->parent_window);
+ }
if (priv->screen)
g_object_unref (priv->screen);
@@ -1736,21 +1741,20 @@ gtk_mount_operation_set_parent (GtkMountOperation *op,
g_signal_handlers_disconnect_by_func (priv->parent_window,
gtk_widget_destroyed,
&priv->parent_window);
- priv->parent_window = NULL;
+ g_object_unref (priv->parent_window);
}
-
- if (parent)
+ priv->parent_window = parent;
+ if (priv->parent_window)
{
- priv->parent_window = g_object_ref (parent);
-
- g_signal_connect (parent, "destroy",
+ g_object_ref (priv->parent_window);
+ g_signal_connect (priv->parent_window, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&priv->parent_window);
-
- if (priv->dialog)
- gtk_window_set_transient_for (GTK_WINDOW (priv->dialog), parent);
}
+ if (priv->dialog)
+ gtk_window_set_transient_for (GTK_WINDOW (priv->dialog), priv->parent_window);
+
g_object_notify (G_OBJECT (op), "parent");
}