gvfs r1781 - in trunk: . client



Author: hansp
Date: Fri May 23 01:31:54 2008
New Revision: 1781
URL: http://svn.gnome.org/viewvc/gvfs?rev=1781&view=rev

Log:
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.



Modified:
   trunk/ChangeLog
   trunk/client/gvfsfusedaemon.c

Modified: trunk/client/gvfsfusedaemon.c
==============================================================================
--- trunk/client/gvfsfusedaemon.c	(original)
+++ trunk/client/gvfsfusedaemon.c	Fri May 23 01:31:54 2008
@@ -2015,6 +2015,9 @@
   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 @@
           *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 @@
       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 @@
   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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]