mirror of
https://github.com/irssi/irssi.git
synced 2026-08-20 00:52:30 +02:00
Disallow unloading of static modules
This commit is contained in:
parent
75d7e1b0bb
commit
d1e60a3b8f
1 changed files with 14 additions and 5 deletions
|
|
@ -195,6 +195,8 @@ static void cmd_unload(const char *data)
|
||||||
MODULE_FILE_REC *file;
|
MODULE_FILE_REC *file;
|
||||||
char *rootmodule, *submodule;
|
char *rootmodule, *submodule;
|
||||||
void *free_arg;
|
void *free_arg;
|
||||||
|
GSList *tmp;
|
||||||
|
int all_dynamic;
|
||||||
|
|
||||||
g_return_if_fail(data != NULL);
|
g_return_if_fail(data != NULL);
|
||||||
|
|
||||||
|
|
@ -204,14 +206,21 @@ static void cmd_unload(const char *data)
|
||||||
|
|
||||||
module = module_find(rootmodule);
|
module = module_find(rootmodule);
|
||||||
if (module != NULL) {
|
if (module != NULL) {
|
||||||
if (*submodule == '\0')
|
if (*submodule == '\0') {
|
||||||
module_unload(module);
|
all_dynamic = 1;
|
||||||
|
for (tmp = module->files; tmp != NULL; tmp = tmp->next)
|
||||||
|
all_dynamic &= !MODULE_IS_STATIC((MODULE_FILE_REC*) tmp->data);
|
||||||
|
if (all_dynamic)
|
||||||
|
module_unload(module);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
file = module_file_find(module, submodule);
|
file = module_file_find(module, submodule);
|
||||||
if (file != NULL)
|
if (file != NULL) {
|
||||||
module_file_unload(file);
|
if (!MODULE_IS_STATIC(file))
|
||||||
|
module_file_unload(file);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
module = NULL;
|
module = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue