e17/evry: fix segfault in aggregator when two instances of evry are open

second instance had not set p->config


SVN revision: 59770
This commit is contained in:
Hannes Janetzek 2011-05-28 10:46:40 +00:00
parent 7418b3cc92
commit 27c4cf72d2
1 changed files with 20 additions and 15 deletions

View File

@ -121,28 +121,31 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority)
{ {
Eina_List *l; Eina_List *l;
Plugin_Config *pc; Plugin_Config *pc;
Eina_List *conf[3]; Eina_List *conf;
int new_conf = 0; int new_conf = 0;
if ((type < 0) || (type > 2)) if ((type < 0) || (type > 2))
return 0; return 0;
conf[0] = evry_conf->conf_subjects; if (type == EVRY_PLUGIN_SUBJECT)
conf[1] = evry_conf->conf_actions; conf = evry_conf->conf_subjects;
conf[2] = evry_conf->conf_objects; else if (type == EVRY_PLUGIN_ACTION)
conf = evry_conf->conf_actions;
else if (type == EVRY_PLUGIN_OBJECT)
conf = evry_conf->conf_objects;
EINA_LIST_FOREACH(conf[type], l, pc) EINA_LIST_FOREACH(conf, l, pc)
if (pc->name && p->name && !strcmp(pc->name, p->name)) if (pc->name && p->name && !strcmp(pc->name, p->name))
break; break;
/* check if module of same name is already loaded */ /* check if module of same name is already loaded */
if ((pc) && (pc->plugin)) /* if ((pc) && (pc->plugin))
return 0; * return 0; */
/* collection plugin sets its own config */ /* collection plugin sets its own config */
if (!pc && p->config) if (!pc && p->config)
{ {
conf[type] = eina_list_append(conf[type], p->config); conf = eina_list_append(conf, p->config);
pc = p->config; pc = p->config;
} }
else if (!pc) else if (!pc)
@ -156,7 +159,7 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority)
pc->aggregate = EINA_TRUE; pc->aggregate = EINA_TRUE;
pc->top_level = EINA_TRUE; pc->top_level = EINA_TRUE;
conf[type] = eina_list_append(conf[type], pc); conf = eina_list_append(conf, pc);
} }
if (pc->trigger && strlen(pc->trigger) == 0) if (pc->trigger && strlen(pc->trigger) == 0)
{ {
@ -167,14 +170,16 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority)
p->config = pc; p->config = pc;
pc->plugin = p; pc->plugin = p;
conf[type] = eina_list_sort(conf[type], -1, _evry_cb_plugin_sort); conf = eina_list_sort(conf, -1, _evry_cb_plugin_sort);
evry_conf->conf_subjects = conf[0]; if (type == EVRY_PLUGIN_SUBJECT)
evry_conf->conf_actions = conf[1]; evry_conf->conf_subjects = conf;
evry_conf->conf_objects = conf[2]; else if (type == EVRY_PLUGIN_ACTION)
evry_conf->conf_actions = conf;
else if (type == EVRY_PLUGIN_OBJECT)
evry_conf->conf_objects = conf;
if ((type == EVRY_PLUGIN_SUBJECT) && if ((type == EVRY_PLUGIN_SUBJECT) && (strcmp(p->name, "All")))
(strcmp(p->name, "All")))
{ {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name); snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name);