diff options
author | Thynson <lanxingcan@gmail.com> | 2011-12-16 23:32:23 +0800 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-12-18 13:24:22 +0100 |
commit | 8b7140f2a9b43e003152e73f69eca1468ba750bf (patch) | |
tree | 3b3a1b9261f448d2328f80a876073cc00162d3ee /plugins.c | |
parent | cf4552a59648a00949e1143e86ff28cfb7840156 (diff) |
plugin: avoid plugins to be loaded twice
The original implementation will load plugins from both
(XDG_LOCAL_HOME|HOME)/.local/lib/deadbeef and configured path, the latter is
ussualy in $PREFIX/lib/deadbeef. However if the deadbeef is configured to be
installed in $HOME/.local, it may cause the each plugin will be load twice.
Despite that there must be a bug in a plugin which is not reentrant, it should
avoid this anyway.
Diffstat (limited to 'plugins.c')
-rw-r--r-- | plugins.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -779,6 +779,14 @@ plug_load_all (void) { // load from HOME 1st, than replace from installdir if needed const char *plugins_dirs[] = { xdg_plugin_dir, dirname, NULL }; + + // If xdg_plugin_dir and dirname is the same, we should avoid each plugin + // to be load twice. + // XXX: Here absolute path is assumed, however if dirname is a relative + // path it won't work. + if (strcmp(xdg_plugin_dir, dirname) == 0) { + plugins_dirs[1] = NULL; + } #else const char *plugins_dirs[] = { dirname, NULL }; #endif |