summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-01-14 16:49:49 +0100
committerwm4 <wm4@nowhere>2017-01-14 17:14:30 +0100
commite91331e683f4e66d9945d89e54a25b3b9610116d (patch)
tree8bdb878b3ac7aa40806062bba423a0cd38c08271
parent191cdbd31ed6f4a8fbbd55a6ec81db7dcc1d457c (diff)
downloadmpv-e91331e683f4e66d9945d89e54a25b3b9610116d.tar.bz2
mpv-e91331e683f4e66d9945d89e54a25b3b9610116d.tar.xz
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.
-rw-r--r--player/scripting.c4
1 files 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;
}