Shut down fam (including removing fam GSource) when module is unloaded
authorAlexander Larsson <alexl@redhat.com>
Fri, 14 Mar 2008 11:02:42 +0000 (11:02 +0000)
committerAlexander Larsson <alexl@src.gnome.org>
Fri, 14 Mar 2008 11:02:42 +0000 (11:02 +0000)
2008-03-14  Alexander Larsson  <alexl@redhat.com>

        * fam/fam-helper.[ch]:
        * fam/fam-module.c:
Shut down fam (including removing fam GSource) when
module is unloaded (#521513)
Patch from Joe Marcus Clarke

svn path=/trunk/; revision=6706

gio/ChangeLog
gio/fam/fam-helper.c
gio/fam/fam-helper.h
gio/fam/fam-module.c

index 721210d46057d4ac7ce0a70fe62b69c2d97cb5c8..922e4b50b04f821e2d9c22c159ccc905ee64a2f6 100644 (file)
@@ -1,3 +1,11 @@
+2008-03-14  Alexander Larsson  <alexl@redhat.com>
+
+        * fam/fam-helper.[ch]:
+        * fam/fam-module.c:
+       Shut down fam (including removing fam GSource) when
+       module is unloaded (#521513)
+       Patch from Joe Marcus Clarke   
+
 2008-03-14  Alexander Larsson  <alexl@redhat.com>
 
         * giomodule.c:
index c6b2c5f38419ab396273d2ed31e25494cfe24d88..164e3ab21222fff6f8d04958bda8ac4c70becdfa 100644 (file)
@@ -181,6 +181,22 @@ _fam_sub_startup (void)
   return TRUE;
 }
 
+void
+_fam_sub_shutdown (void)
+{
+  G_LOCK (fam_connection);
+
+  if (fam_connection != NULL) {
+    FAMClose (fam_connection);
+    g_free (fam_connection);
+    g_source_remove (fam_watch_id);
+    fam_watch_id = 0;
+    fam_connection = NULL;
+  }
+
+  G_UNLOCK (fam_connection);
+}
+
 fam_sub*
 _fam_sub_add (const gchar* pathname,
              gboolean directory,
index e8acbfeff36bd6454e95e3dbab15522ff5ba5615..05e67d11f9e269542ef00cc4d95f898e86aff179 100644 (file)
@@ -28,6 +28,7 @@
 typedef struct _fam_sub fam_sub;
 
 gboolean  _fam_sub_startup (void);
+void      _fam_sub_shutdown (void);
 fam_sub*  _fam_sub_add     (const gchar* pathname,
                            gboolean     directory,
                            gpointer     user_data);
index d7b9cfcae9c8c29f0aa49d8963370da6246b7e08..70e8dea22f5d473e8817064b682d912b3b5296f2 100644 (file)
@@ -26,6 +26,7 @@
 #include "giomodule.h"
 #include "gfamdirectorymonitor.h"
 #include "gfamfilemonitor.h"
+#include "fam-helper.h"
 
 void
 g_io_module_load (GIOModule *module)
@@ -37,5 +38,6 @@ g_io_module_load (GIOModule *module)
 void
 g_io_module_unload (GIOModule   *module)
 {
+  _fam_sub_shutdown ();
 }