[gnome-panel] Prevent modules from being unloadable



commit 0ace553ed8b0a28ac538c4d970dbe7a6d52d7529
Author: Ray Strode <rstrode redhat com>
Date:   Fri Sep 10 17:36:44 2010 -0400

    Prevent modules from being unloadable
    
    The bonobo compatibility module doesn't support unloading.
    In general, it's really hard to write a module that can be
    safely unloaded and then reloaded later. Also, there's not
    much point in supporting it for the panel's use case.  Therefore,
    we won't anymore.  That solves the bonobo issue and any future
    issues that could potentially crop up.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=629535

 gnome-panel/panel-modules.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gnome-panel/panel-modules.c b/gnome-panel/panel-modules.c
index 7719385..5afe559 100644
--- a/gnome-panel/panel-modules.c
+++ b/gnome-panel/panel-modules.c
@@ -55,9 +55,15 @@ panel_modules_ensure_loaded (void)
 	panel_modules_ensure_extension_points_registered ();
 
 	if (!loaded_dirs) {
+		GList *modules;
 		loaded_dirs = TRUE;
 
-		g_io_modules_scan_all_in_directory (PANEL_MODULES_DIR);
+		/* We load the modules explicitly instead of using scan_all
+		 * so that we can leak a reference to them.  This prevents them
+		 * from getting unloaded later (something they aren't designed
+		 * to cope with) */
+		modules = g_io_modules_load_all_in_directory (PANEL_MODULES_DIR);
+		g_list_free (modules);
 
 		module_path = g_getenv ("GNOME_PANEL_EXTRA_MODULES");
 
@@ -67,8 +73,10 @@ panel_modules_ensure_loaded (void)
 
 			paths = g_strsplit (module_path, ":", 0);
 
-			for (i = 0; paths[i] != NULL; i++)
-				g_io_modules_scan_all_in_directory (paths[i]);
+			for (i = 0; paths[i] != NULL; i++) {
+				modules = g_io_modules_load_all_in_directory (paths[i]);
+				g_list_free (modules);
+			}
 
 			g_strfreev (paths);
 		}



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