From c79d67ac1f7d91759a77f7a7397701d178e0b4a9 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 18 Oct 2008 22:26:37 +0200 Subject: [PATCH] obexd: Add workaround for broken libraries within plugins --- obexd/src/plugin.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/obexd/src/plugin.c b/obexd/src/plugin.c index 13dda96a3..b6320d43a 100644 --- a/obexd/src/plugin.c +++ b/obexd/src/plugin.c @@ -35,6 +35,17 @@ #include "plugin.h" #include "logging.h" +/* + * Plugins that are using libraries with threads and their own mainloop + * will crash on exit. This is a bug inside these libraries, but there is + * nothing much that can be done about it. One bad example is libebook. + */ +#ifdef NEED_THREADS +#define PLUGINFLAG (RTLD_NOW | RTLD_NODELETE) +#else +#define PLUGINFLAG (RTLD_NOW) +#endif + static GSList *plugins = NULL; struct obex_plugin { @@ -99,7 +110,7 @@ gboolean plugin_init(void) continue; } - handle = dlopen(filename, RTLD_NOW); + handle = dlopen(filename, PLUGINFLAG); if (handle == NULL) { error("Can't load plugin %s: %s", filename, dlerror()); -- 2.47.3