Prevent loading the same plugin in different paths.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1770 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-08-04 16:25:13 +00:00
parent 6c36b8dcab
commit 1f2aa9d983
2 changed files with 12 additions and 3 deletions

View File

@ -2,6 +2,7 @@
* configure.in: Fix error in "make install" caused by old automake * configure.in: Fix error in "make install" caused by old automake
versions and intltool. versions and intltool.
* src/plugins.c: Prevent loading the same plugin in different paths.
2007-08-03 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> 2007-08-03 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -161,16 +161,24 @@ geany_data_init()
static gboolean static gboolean
plugin_loaded(GModule *module) plugin_loaded(GModule *module)
{ {
const gchar *fname = g_module_name(module); gchar *basename_module, *basename_loaded;
GList *item; GList *item;
basename_module = g_path_get_basename(g_module_name(module));
for (item = plugin_list; item != NULL; item = g_list_next(item)) for (item = plugin_list; item != NULL; item = g_list_next(item))
{ {
Plugin *p = item->data; basename_loaded = g_path_get_basename(
g_module_name(((Plugin*)item->data)->module));
if (utils_str_equal(fname, g_module_name(p->module))) if (utils_str_equal(basename_module, basename_loaded))
{
g_free(basename_loaded);
g_free(basename_module);
return TRUE; return TRUE;
} }
g_free(basename_loaded);
}
g_free(basename_module);
return FALSE; return FALSE;
} }