[elm_code] don't double free standard parsers

This commit is contained in:
Andy Williams 2016-05-16 11:01:12 +01:00
parent 828bfb4d27
commit b1cc9c7876
3 changed files with 14 additions and 1 deletions

View File

@ -95,7 +95,7 @@ elm_code_free(Elm_Code *code)
EINA_LIST_FREE(code->parsers, parser)
{
free(parser);
_elm_code_parser_free(parser);
}
free(code);

View File

@ -13,6 +13,7 @@ struct _Elm_Code_Parser
void (*parse_file)(Elm_Code_File *, void *);
void *data;
Eina_Bool standard;
};
@ -69,6 +70,7 @@ _elm_code_parser_new(void (*parse_line)(Elm_Code_Line *, void *),
parser->parse_line = parse_line;
parser->parse_file = parse_file;
parser->standard = EINA_FALSE;
return parser;
}
@ -95,6 +97,7 @@ elm_code_parser_standard_add(Elm_Code *code, Elm_Code_Parser *parser)
if (!parser || !code)
return;
parser->standard = EINA_TRUE;
code->parsers = eina_list_append(code->parsers, parser);
}
@ -185,6 +188,15 @@ _elm_code_parser_todo_parse_line(Elm_Code_Line *line, void *data EINA_UNUSED)
elm_code_line_status_set(line, ELM_CODE_STATUS_TYPE_TODO);
}
void
_elm_code_parser_free(Elm_Code_Parser *parser)
{
if (parser->standard)
return;
free(parser);
}
void
_elm_code_parse_setup()
{

View File

@ -34,5 +34,6 @@ void _elm_code_parse_file(Elm_Code *code, Elm_Code_File *file);
void _elm_code_parse_reset_file(Elm_Code *code, Elm_Code_File *file);
void _elm_code_parser_free(Elm_Code_Parser *parser);
#endif