glib r6707 - in branches/glib-2-16/gio: . fam



Author: alexl
Date: Fri Mar 14 11:03:32 2008
New Revision: 6707
URL: http://svn.gnome.org/viewvc/glib?rev=6707&view=rev

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




Modified:
   branches/glib-2-16/gio/ChangeLog
   branches/glib-2-16/gio/fam/fam-helper.c
   branches/glib-2-16/gio/fam/fam-helper.h
   branches/glib-2-16/gio/fam/fam-module.c

Modified: branches/glib-2-16/gio/fam/fam-helper.c
==============================================================================
--- branches/glib-2-16/gio/fam/fam-helper.c	(original)
+++ branches/glib-2-16/gio/fam/fam-helper.c	Fri Mar 14 11:03:32 2008
@@ -181,6 +181,22 @@
   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,

Modified: branches/glib-2-16/gio/fam/fam-helper.h
==============================================================================
--- branches/glib-2-16/gio/fam/fam-helper.h	(original)
+++ branches/glib-2-16/gio/fam/fam-helper.h	Fri Mar 14 11:03:32 2008
@@ -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);

Modified: branches/glib-2-16/gio/fam/fam-module.c
==============================================================================
--- branches/glib-2-16/gio/fam/fam-module.c	(original)
+++ branches/glib-2-16/gio/fam/fam-module.c	Fri Mar 14 11:03:32 2008
@@ -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 @@
 void
 g_io_module_unload (GIOModule   *module)
 {
+  _fam_sub_shutdown ();
 }
 



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