From 6fc66109a07e3fc2e5e603eb17793ccc25ed1f9d Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 14 Mar 2008 11:02:42 +0000 Subject: [PATCH] Shut down fam (including removing fam GSource) when module is unloaded 2008-03-14 Alexander Larsson * 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 | 8 ++++++++ gio/fam/fam-helper.c | 16 ++++++++++++++++ gio/fam/fam-helper.h | 1 + gio/fam/fam-module.c | 2 ++ 4 files changed, 27 insertions(+) diff --git a/gio/ChangeLog b/gio/ChangeLog index 721210d..922e4b5 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,5 +1,13 @@ 2008-03-14 Alexander Larsson + * 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 + * giomodule.c: (_g_io_modules_ensure_loaded): Fix up FEN ifdefs diff --git a/gio/fam/fam-helper.c b/gio/fam/fam-helper.c index c6b2c5f..164e3ab 100644 --- a/gio/fam/fam-helper.c +++ b/gio/fam/fam-helper.c @@ -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, diff --git a/gio/fam/fam-helper.h b/gio/fam/fam-helper.h index e8acbfe..05e67d1 100644 --- a/gio/fam/fam-helper.h +++ b/gio/fam/fam-helper.h @@ -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); diff --git a/gio/fam/fam-module.c b/gio/fam/fam-module.c index d7b9cfc..70e8dea 100644 --- a/gio/fam/fam-module.c +++ b/gio/fam/fam-module.c @@ -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 (); } -- 2.7.4