mirror of
https://github.com/mpv-player/mpv
synced 2025-03-09 15:47:44 +00:00
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.
This commit is contained in:
parent
191cdbd31e
commit
e91331e683
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user