Shut down fam (including removing fam GSource) when module is unloaded

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
This commit is contained in:
Alexander Larsson 2008-03-14 11:02:42 +00:00 committed by Alexander Larsson
parent 9555a3a2ca
commit 6fc66109a0
4 changed files with 27 additions and 0 deletions

View 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> 2008-03-14 Alexander Larsson <alexl@redhat.com>
* giomodule.c: * giomodule.c:

View File

@ -181,6 +181,22 @@ _fam_sub_startup (void)
return TRUE; 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*
_fam_sub_add (const gchar* pathname, _fam_sub_add (const gchar* pathname,
gboolean directory, gboolean directory,

View File

@ -28,6 +28,7 @@
typedef struct _fam_sub fam_sub; typedef struct _fam_sub fam_sub;
gboolean _fam_sub_startup (void); gboolean _fam_sub_startup (void);
void _fam_sub_shutdown (void);
fam_sub* _fam_sub_add (const gchar* pathname, fam_sub* _fam_sub_add (const gchar* pathname,
gboolean directory, gboolean directory,
gpointer user_data); gpointer user_data);

View File

@ -26,6 +26,7 @@
#include "giomodule.h" #include "giomodule.h"
#include "gfamdirectorymonitor.h" #include "gfamdirectorymonitor.h"
#include "gfamfilemonitor.h" #include "gfamfilemonitor.h"
#include "fam-helper.h"
void void
g_io_module_load (GIOModule *module) g_io_module_load (GIOModule *module)
@ -37,5 +38,6 @@ g_io_module_load (GIOModule *module)
void void
g_io_module_unload (GIOModule *module) g_io_module_unload (GIOModule *module)
{ {
_fam_sub_shutdown ();
} }