From 7bea0dab48f1b8665e8f003c48b80aa996cf75a5 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Fri, 18 Apr 2014 14:59:09 +0200 Subject: [PATCH] plugin: Keep a global reference of a plugin context if it's still in use. D'oh! --- src/core/plugin.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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); } -- 2.30.2