From e91331e683f4e66d9945d89e54a25b3b9610116d Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 14 Jan 2017 16:49:49 +0100 Subject: scripting: don't call dlclose() on C plugins Can break things quite badly. Example: reloading a plugin linked against GTK 3.x can cause a segfault if you call dlclose() on it. According to GTK developers, unloading the GTK library is unsupported. --- player/scripting.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/player/scripting.c b/player/scripting.c index a72668d050..092404231d 100644 --- a/player/scripting.c +++ b/player/scripting.c @@ -245,13 +245,13 @@ static int load_cplugin(struct mpv_handle *client, const char *fname) void *lib = dlopen(fname, RTLD_NOW | RTLD_LOCAL); if (!lib) goto error; + // Note: once loaded, we never unload, as unloading the libraries linked to + // the plugin can cause random serious problems. mpv_open_cplugin sym = (mpv_open_cplugin)dlsym(lib, MPV_DLOPEN_FN); if (!sym) goto error; r = sym(client) ? -1 : 0; error: - if (lib) - dlclose(lib); return r; } -- cgit v1.2.3