From: Sebastian Harl Date: Fri, 18 Apr 2014 12:59:09 +0000 (+0200) Subject: plugin: Keep a global reference of a plugin context if it's still in use. X-Git-Tag: sysdb-0.1.0~118 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7bea0dab48f1b8665e8f003c48b80aa996cf75a5;p=sysdb.git plugin: Keep a global reference of a plugin context if it's still in use. D'oh! --- diff --git a/src/core/plugin.c b/src/core/plugin.c index e67f814..e6df9e9 100644 --- a/src/core/plugin.c +++ b/src/core/plugin.c @@ -239,9 +239,9 @@ plugin_unregister_by_name(const char *plugin_name) } } - obj = sdb_llist_remove_by_name(all_plugins, plugin_name); + obj = sdb_llist_search_by_name(all_plugins, plugin_name); if (obj->ref_cnt <= 1) - sdb_log(SDB_LOG_INFO, "core: Unloading module %s", plugin_name); + sdb_llist_remove_by_name(all_plugins, plugin_name); /* else: other callbacks still reference it */ sdb_object_deref(obj); } /* plugin_unregister_by_name */ @@ -271,10 +271,14 @@ ctx_destroy(sdb_object_t *obj) if (ctx->handle) { const char *err; + + sdb_log(SDB_LOG_INFO, "core: Unloading module %s", + ctx->info.plugin_name); + lt_dlerror(); lt_dlclose(ctx->handle); if ((err = lt_dlerror())) - sdb_log(SDB_LOG_WARNING, "core: Failed to unload plugin %s: %s", + sdb_log(SDB_LOG_WARNING, "core: Failed to unload module %s: %s", ctx->info.plugin_name, err); }