Code

plugin: Unset the plugin context before unregistering a plugin.
authorSebastian Harl <sh@tokkee.org>
Sun, 20 Apr 2014 18:20:07 +0000 (20:20 +0200)
committerSebastian Harl <sh@tokkee.org>
Sun, 20 Apr 2014 18:20:07 +0000 (20:20 +0200)
Else, the context is still considered to be in use and, thus, won't be removed
from the global plugin (context) list.

src/core/plugin.c

index 188c7db1515859739efff2c456bd00c62f893f98..fe8844a505d061e1df09ec9a720d95c2f30fb9c9 100644 (file)
@@ -809,10 +809,12 @@ sdb_plugin_init_all(void)
                if (callback(cb->cb_user_data)) {
                        sdb_log(SDB_LOG_ERR, "core: Failed to initialize plugin "
                                        "'%s'. Unregistering all callbacks.", obj->name);
+                       ctx_set(old_ctx);
                        plugin_unregister_by_name(cb->cb_ctx->info.plugin_name);
                        ++ret;
                }
-               ctx_set(old_ctx);
+               else
+                       ctx_set(old_ctx);
        }
        sdb_llist_iter_destroy(iter);
        return ret;