[gtk+] placesview: hold onto ref during (un)mount ops
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] placesview: hold onto ref during (un)mount ops
- Date: Fri, 9 Sep 2016 20:55:59 +0000 (UTC)
commit 3ed25941ac80a4630b5c25a420307f9562a59ece
Author: Christian Kellner <christian kellner me>
Date: Sun Sep 4 11:47:55 2016 +0200
placesview: hold onto ref during (un)mount ops
During mount and unmount opertions we keep a reference to the
GtkPlacesView around, so we have a valid view for the callback
code, even in the case that othe external references have been
dropped (i.e. the containing window gets destroyed).
https://bugzilla.gnome.org/show_bug.cgi?id=764979
gtk/gtkplacesview.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index 4817c4b..581c4cc 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -1207,6 +1207,7 @@ server_mount_ready_cb (GObject *source_file,
}
update_places (view);
+ g_object_unref (view);
}
static void
@@ -1277,6 +1278,7 @@ volume_mount_ready_cb (GObject *source_volume,
}
update_places (view);
+ g_object_unref (view);
}
static void
@@ -1311,6 +1313,8 @@ unmount_ready_cb (GObject *source_mount,
g_clear_error (&error);
}
+
+ g_object_unref (view);
}
static gboolean
@@ -1355,6 +1359,8 @@ unmount_mount (GtkPlacesView *view,
priv->unmounting_mount = TRUE;
update_loading (view);
+ g_object_ref (view);
+
operation = gtk_mount_operation_new (GTK_WINDOW (toplevel));
g_mount_unmount_with_operation (mount,
0,
@@ -1398,6 +1404,9 @@ mount_server (GtkPlacesView *view,
g_mount_operation_set_password_save (operation, G_PASSWORD_SAVE_FOR_SESSION);
+ /* make sure we keep the view around for as long as we are running */
+ g_object_ref (view);
+
g_file_mount_enclosing_volume (location,
0,
operation,
@@ -1430,6 +1439,9 @@ mount_volume (GtkPlacesView *view,
g_mount_operation_set_password_save (operation, G_PASSWORD_SAVE_FOR_SESSION);
+ /* make sure we keep the view around for as long as we are running */
+ g_object_ref (view);
+
g_volume_mount (volume,
0,
operation,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]