Elm: module unloading

Implements the module unloading to all modules on elm_module_shutdown.
This change also fixes a memory leak within elm_module picked by valgrind.

Here follows the valgrind log:

96 bytes in 1 blocks are definitely lost in loss record 105 of 168
    at 0x4C29DB4: calloc (
            in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
            by 0x52065B6: _elm_module_add (elm_module.c:223)
            by 0x520669E: _elm_module_parse (elm_module.c:77)
            by 0x51F1249: elm_quicklaunch_sub_init (elm_main.c:437)
            by 0x51F12BE: elm_init (elm_main.c:180)

Patch by Leandro Dorileo <dorileo@profusion.mobi>



SVN revision: 72499
This commit is contained in:
Bruno Dilly 2012-06-19 18:24:17 +00:00
parent 04061fc239
commit d6341bfc9e
1 changed files with 15 additions and 3 deletions

View File

@ -42,9 +42,21 @@ _elm_module_init(void)
void
_elm_module_shutdown(void)
{
// FIXME: unload all modules
if (modules) eina_hash_free(modules);
modules = NULL;
Eina_Iterator *it;
Elm_Module *m;
if (modules)
{
it = eina_hash_iterator_data_new(modules);
EINA_ITERATOR_FOREACH(it, m)
_elm_module_del(m);
eina_iterator_free(it);
eina_hash_free(modules);
modules = NULL;
}
if (modules_as) eina_hash_free(modules_as);
modules_as = NULL;
}