diff --git a/src/core/plugin.c b/src/core/plugin.c
index 18ea82c77fc8475d73dfb9e4a37b8a7a693443fc..e6df9e9c2a9da7b1746fba2121492dbce630f0bc 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
}
}
}
}
- 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)
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 */
/* else: other callbacks still reference it */
sdb_object_deref(obj);
} /* plugin_unregister_by_name */
if (ctx->handle) {
const char *err;
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()))
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);
}
ctx->info.plugin_name, err);
}
if (! plugin_ctx_key_initialized)
ctx_key_init();
if (! plugin_ctx_key_initialized)
ctx_key_init();
+ sdb_object_ref(SDB_OBJ(ctx));
pthread_setspecific(plugin_ctx_key, ctx);
return ctx;
} /* ctx_create */
pthread_setspecific(plugin_ctx_key, ctx);
return ctx;
} /* ctx_create */
ctx_key_init();
old = pthread_getspecific(plugin_ctx_key);
ctx_key_init();
old = pthread_getspecific(plugin_ctx_key);
+ if (old)
+ sdb_object_deref(SDB_OBJ(old));
+ if (new)
+ sdb_object_ref(SDB_OBJ(new));
pthread_setspecific(plugin_ctx_key, new);
return old;
} /* ctx_set */
pthread_setspecific(plugin_ctx_key, new);
return old;
} /* ctx_set */