edc_parser&autocomp: Fix double click issue on WindowsOS

Summary:
Enventor window stops responding on double clicking "min" on Windows.
Because of approaching the index in which the cur_context doesn't exist, the crash happens.
*cur_context[] in parser_attribute_get() edc_parser.c

Test Plan:
1. launch enventor on Windows
2. add image using live edit
3. double click "min" on editor

@TSAM-3524

Reviewers: Jaehyun_Cho, Hermet

Differential Revision: https://phab.enlightenment.org/D3972
This commit is contained in:
Bowon Ryu 2016-05-24 11:58:35 +09:00 committed by Hermet Park
parent c77cfc6499
commit cc538a8508
3 changed files with 12 additions and 8 deletions

View File

@ -932,12 +932,13 @@ autocomp_enabled_get(void)
}
const char **
autocomp_current_context_get(void)
autocomp_current_context_get(int *name_count)
{
autocomp_data *ad = g_ad;
if (!ad->lexem_ptr || !ad->lexem_ptr->name)
return NULL;
*name_count = ad->lexem_ptr->name_count;
return (const char **)ad->lexem_ptr->name;
}

View File

@ -1547,8 +1547,9 @@ parser_attribute_get(parser_data *pd, const char *text, const char *cur,
}
if (instring) return NULL;
const char **cur_context = autocomp_current_context_get();
int i = 0;
int name_count;
const char **cur_context = autocomp_current_context_get(&name_count);
int i;
EINA_INARRAY_FOREACH(pd->attrs, attr)
{
@ -1557,11 +1558,13 @@ parser_attribute_get(parser_data *pd, const char *text, const char *cur,
if (!attr->context)
return &attr->value;
while (cur_context && (cur_context[i] != NULL))
if (cur_context)
{
if (!strcmp(cur_context[i], attr->context))
return &attr->value;
i++;
for (i = 0; i < name_count; i++)
{
if (!strcmp(cur_context[i], attr->context))
return &attr->value;
}
}
}
}

View File

@ -89,7 +89,7 @@ Eina_Bool autocomp_enabled_get(void);
Eina_Bool autocomp_event_dispatch(const char *key);
void autocomp_list_show(void);
void autocomp_reset(void);
const char **autocomp_current_context_get(void);
const char **autocomp_current_context_get(int *name_count);
/* syntax color */