summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander van der Meij <[email protected]>2016-03-06 09:07:30 +0100
committermonsta <[email protected]>2016-03-14 14:06:00 +0300
commit4b5bcc5c67a070e6f29376213e3da993553d8f2b (patch)
tree7e5502038e425ad93895fdceba701b3c41865a17
parent2a949e219e8d43b475ac7fd7b17519b0467b9152 (diff)
downloadcaja-4b5bcc5c67a070e6f29376213e3da993553d8f2b.tar.bz2
caja-4b5bcc5c67a070e6f29376213e3da993553d8f2b.tar.xz
add check to prevent extensions from being loaded multiple times
-rw-r--r--libcaja-private/caja-extensions.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/libcaja-private/caja-extensions.c b/libcaja-private/caja-extensions.c
index 7f4791ec..78b4af06 100644
--- a/libcaja-private/caja-extensions.c
+++ b/libcaja-private/caja-extensions.c
@@ -192,13 +192,23 @@ caja_extensions_get_list (void)
void
caja_extension_register (gchar *filename, GObject *module)
{
- gboolean state = TRUE; // new extensions are enabled by default.
- gchar *extname;
+ gboolean ext_state = TRUE; // new extensions are enabled by default.
+ gchar *ext_filename;
+ GList *l;
- extname = g_strndup (filename, strlen(filename) - 3);
- state = caja_extension_get_state (extname);
+ ext_filename = g_strndup (filename, strlen(filename) - 3);
+ ext_state = caja_extension_get_state (ext_filename);
+
+ /* Do not attempt to register already registered extensions */
+ for (l = caja_extensions; l != NULL; l = l->next)
+ {
+ Extension *r = l->data;
+ if (g_ascii_strcasecmp (r->filename, ext_filename) == 0) {
+ return;
+ }
+ }
- Extension *ext = extension_new (extname, state, module);
+ Extension *ext = extension_new (ext_filename, ext_state, module);
caja_extensions = g_list_append (caja_extensions, ext);
}