diff options
author | Hans Petter Jansson <hpj@novell.com> | 2008-05-23 01:31:54 +0000 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2008-05-23 01:31:54 +0000 |
commit | 1569a35e7d8c3ad60ebfd92986aee0fa28747cf8 (patch) | |
tree | 61e30423b8fbd3c2ba8b067fc553f208f1c823a0 /client | |
parent | 169d4f3511eb9fd57df1c71379e495eb2b2baeb3 (diff) | |
download | gvfs-1569a35e7d8c3ad60ebfd92986aee0fa28747cf8.tar.gz |
A more complete fix for GNOME bug #531516.
2008-05-22 Hans Petter Jansson <hpj@novell.com>
A more complete fix for GNOME bug #531516.
* client/gvfsfusedaemon.c (subthread_main): Send SIGHUP to the
main thread just before subthread exits.
(dbus_filter_func): When gvfsd goes away, exit the subthread's
main loop instead of immediately sending SIGHUP to parent thread.
Do the same when the session bus goes away.
(shutdown_on_idle): Remove, no longer needed.
(shutdown_signal): Remove, no longer needed.
(vfs_init): Tell dbus to not exit when session bus goes down.
Don't catch signals anymore, since Fuse does this for us.
svn path=/trunk/; revision=1781
Diffstat (limited to 'client')
-rw-r--r-- | client/gvfsfusedaemon.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/client/gvfsfusedaemon.c b/client/gvfsfusedaemon.c index 7d17ca43..d59ed3cc 100644 --- a/client/gvfsfusedaemon.c +++ b/client/gvfsfusedaemon.c @@ -2015,6 +2015,9 @@ subthread_main (gpointer data) g_object_unref (volume_monitor); volume_monitor = NULL; + /* Tell the main thread to unmount. Using kill() is necessary according to FUSE maintainers. */ + kill (getpid (), SIGHUP); + return NULL; } @@ -2042,26 +2045,20 @@ dbus_filter_func (DBusConnection *connection, *new_owner == 0) { /* The daemon died, unmount */ - kill (getpid(), SIGHUP); + g_main_loop_quit (subthread_main_loop); } } + else if (dbus_message_is_signal (message, + DBUS_INTERFACE_LOCAL, + "Disconnected")) + { + /* Session bus died, unmount */ + g_main_loop_quit (subthread_main_loop); + } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } -static gboolean -shutdown_on_idle (void) -{ - fuse_exit (fuse_get_context ()->fuse); - return FALSE; -} - -static void -shutdown_signal (gint signum) -{ - g_idle_add ((GSourceFunc) shutdown_on_idle, NULL); -} - static gpointer vfs_init (struct fuse_conn_info *conn) { @@ -2088,6 +2085,8 @@ vfs_init (struct fuse_conn_info *conn) return NULL; } + dbus_connection_set_exit_on_disconnect (dbus_conn, FALSE); + _g_dbus_connection_integrate_with_main (dbus_conn); dbus_bus_add_match (dbus_conn, @@ -2114,11 +2113,6 @@ vfs_init (struct fuse_conn_info *conn) volume_monitor = g_object_new (g_type_from_name ("GDaemonVolumeMonitor"), NULL); subthread_main_loop = g_main_loop_new (NULL, FALSE); - - signal (SIGHUP, shutdown_signal); - signal (SIGTERM, shutdown_signal); - signal (SIGINT, shutdown_signal); - subthread = g_thread_create ((GThreadFunc) subthread_main, NULL, FALSE, NULL); return NULL; |