Blame SOURCES/irssi-0.8.15-no-static-unload.patch

8ce1d3
--- irssi-0.8.15/src/fe-common/core/fe-modules.c.old	2010-04-03 18:19:24.000000000 +0200
8ce1d3
+++ irssi-0.8.15/src/fe-common/core/fe-modules.c	2010-10-12 14:43:52.586315553 +0200
8ce1d3
@@ -195,6 +195,8 @@
8ce1d3
         MODULE_FILE_REC *file;
8ce1d3
         char *rootmodule, *submodule;
8ce1d3
 	void *free_arg;
8ce1d3
+	GSList *tmp;
8ce1d3
+	int all_dynamic;
8ce1d3
 
8ce1d3
 	g_return_if_fail(data != NULL);
8ce1d3
 
8ce1d3
@@ -204,12 +206,19 @@
8ce1d3
 
8ce1d3
 	module = module_find(rootmodule);
8ce1d3
 	if (module != NULL) {
8ce1d3
-		if (*submodule == '\0')
8ce1d3
-			module_unload(module);
8ce1d3
+		if (*submodule == '\0') {
8ce1d3
+			all_dynamic = 1;
8ce1d3
+			for (tmp = module->files; tmp != NULL; tmp = tmp->next)
8ce1d3
+				all_dynamic &= !MODULE_IS_STATIC((MODULE_FILE_REC*) tmp->data);
8ce1d3
+			if (all_dynamic)
8ce1d3
+				module_unload(module);
8ce1d3
+		}
8ce1d3
 		else {
8ce1d3
 			file = module_file_find(module, submodule);
8ce1d3
-                        if (file != NULL)
8ce1d3
-				module_file_unload(file);
8ce1d3
+                        if (file != NULL) {
8ce1d3
+				if (!MODULE_IS_STATIC(file))
8ce1d3
+					module_file_unload(file);
8ce1d3
+			}
8ce1d3
 			else
8ce1d3
                                 module = NULL;
8ce1d3
 		}