Autocomplete: fix memory leak on autocomplete terminate.
Summary: Tree structure of lexems didn't freed, when feature terminating. Reviewers: Hermet Differential Revision: https://phab.enlightenment.org/D2727
This commit is contained in:
parent
02af80d3ba
commit
9f47246074
|
@ -100,6 +100,27 @@ init_thread_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
|
|||
autocomp_load(ad);
|
||||
}
|
||||
|
||||
static void
|
||||
lexem_tree_free(lexem **root)
|
||||
{
|
||||
lexem *data = NULL;
|
||||
Eina_List *l = NULL;
|
||||
|
||||
if (!(*root)) return;
|
||||
|
||||
EINA_LIST_FOREACH((*root)->nodes, l, data)
|
||||
{
|
||||
if (data->nodes)
|
||||
lexem_tree_free(&data);
|
||||
}
|
||||
|
||||
EINA_LIST_FREE((*root)->nodes, data)
|
||||
{
|
||||
free(data->txt);
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
context_lexem_thread_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||
{
|
||||
|
@ -766,6 +787,8 @@ autocomp_term(void)
|
|||
evas_object_del(ad->anchor);
|
||||
ecore_thread_cancel(ad->init_thread);
|
||||
|
||||
lexem_tree_free((lexem **)&ad->lexem_root);
|
||||
|
||||
eet_data_descriptor_free(lex_desc);
|
||||
eet_close(ad->source_file);
|
||||
|
||||
|
|
Loading…
Reference in New Issue