Index: libnautilus-private/nautilus-module.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-module.c,v
retrieving revision 1.5
diff -u -p -d -r1.5 nautilus-module.c
--- libnautilus-private/nautilus-module.c	13 Dec 2005 15:28:52 -0000	1.5
+++ libnautilus-private/nautilus-module.c	2 Jul 2006 14:41:54 -0000
@@ -59,6 +59,8 @@ struct _NautilusModuleClass {
 static GType nautilus_module_get_type (void);
 
 static GList *module_objects = NULL;
+static gboolean nautilus_module_initialized = FALSE;
+
 
 GNOME_CLASS_BOILERPLATE (NautilusModule,
 			 nautilus_module,
@@ -208,13 +210,22 @@ load_module_dir (const char *dirname)
 void
 nautilus_module_init (void)
 {
-	static gboolean initialized = FALSE;
-
-	if (!initialized) {
-		initialized = TRUE;
+	if (!nautilus_module_initialized) {
+		nautilus_module_initialized = TRUE;
 		
 		load_module_dir (NAUTILUS_EXTENSIONDIR);
 	}
+}
+
+void
+nautilus_module_shutdown (void)
+{
+    if (nautilus_module_initialized) {
+        g_list_foreach (module_objects, (GFunc) g_object_unref, NULL);
+        g_list_free (module_objects);
+        module_objects = NULL;
+        nautilus_module_initialized = FALSE;
+    }
 }
 
 GList *
Index: libnautilus-private/nautilus-module.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-module.h,v
retrieving revision 1.2
diff -u -p -d -r1.2 nautilus-module.h
--- libnautilus-private/nautilus-module.h	11 Jan 2004 20:34:32 -0000	1.2
+++ libnautilus-private/nautilus-module.h	2 Jul 2006 14:41:54 -0000
@@ -29,6 +29,7 @@
 G_BEGIN_DECLS
 
 void   nautilus_module_init                    (void);
+void   nautilus_module_shutdown                (void);
 GList *nautilus_module_get_extensions_for_type (GType  type);
 void   nautilus_module_extension_list_free     (GList *list);
 
Index: src/nautilus-main.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-main.c,v
retrieving revision 1.157
diff -u -p -d -r1.157 nautilus-main.c
--- src/nautilus-main.c	21 Jun 2006 16:26:17 -0000	1.157
+++ src/nautilus-main.c	2 Jul 2006 14:41:57 -0000
@@ -52,6 +52,7 @@
 #include <libnautilus-private/nautilus-directory-metafile.h>
 #include <libnautilus-private/nautilus-global-preferences.h>
 #include <libnautilus-private/nautilus-lib-self-check-functions.h>
+#include <libnautilus-private/nautilus-module.h>
 #include <libxml/parser.h>
 #include <stdlib.h>
 #include <string.h>
@@ -367,6 +368,7 @@ main (int argc, char *argv[])
 		}
 	}
 
+	nautilus_module_shutdown ();
 
 	gnome_vfs_shutdown ();
 
