summaryrefslogtreecommitdiff
path: root/src/lib/evas/file/evas_module.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-07-04 20:07:30 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-07-04 21:30:34 +0900
commit9527240d7422ff828f29c54df2211dd9374c2867 (patch)
tree7d3eb05f406b2750f448fea5dfe433441b66bc52 /src/lib/evas/file/evas_module.c
parent49f19a1cb207e148a5d4057f848fbd58edcbccd9 (diff)
efl - fix lots of little init/shutdown pairs that are wrong
i've fixed almost all the eina init/shutdown pairs to do the right thing now... except one (ecore_shutdown) with comment inline where eo_shutdown is not called. if this is called we are in crash land. this needs further inspection.
Diffstat (limited to '')
-rw-r--r--src/lib/evas/file/evas_module.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c
index cda2dafe69..a684f847c4 100644
--- a/src/lib/evas/file/evas_module.c
+++ b/src/lib/evas/file/evas_module.c
@@ -406,6 +406,13 @@ evas_module_unregister(const Evas_Module_Api *module, Evas_Module_Type type)
406 eina_array_data_set(evas_engines, em->id_engine - 1, NULL); 406 eina_array_data_set(evas_engines, em->id_engine - 1, NULL);
407 407
408 eina_hash_del(evas_modules[type], module->name, em); 408 eina_hash_del(evas_modules[type], module->name, em);
409
410 if (em->loaded)
411 {
412 em->definition->func.close(em);
413 em->loaded = 0;
414 }
415
409 LKD(em->lock); 416 LKD(em->lock);
410 free(em); 417 free(em);
411 418
@@ -431,7 +438,11 @@ evas_module_find_type(Evas_Module_Type type, const char *name)
431 if ((unsigned int)type > 3) return NULL; 438 if ((unsigned int)type > 3) return NULL;
432 439
433 em = eina_hash_find(evas_modules[type], name); 440 em = eina_hash_find(evas_modules[type], name);
434 if (em) return em; 441 if (em)
442 {
443 evas_module_load(em);
444 return em;
445 }
435 446
436 run_in_tree = !!getenv("EFL_RUN_IN_TREE"); 447 run_in_tree = !!getenv("EFL_RUN_IN_TREE");
437 448
@@ -607,6 +618,18 @@ evas_module_clean(void)
607 618
608static Eina_Prefix *pfx = NULL; 619static Eina_Prefix *pfx = NULL;
609 620
621static Eina_Bool
622_cb_mod_close(const Eina_Hash *hash EINA_UNUSED,
623 const void *key EINA_UNUSED,
624 void *data, void *fdata EINA_UNUSED)
625{
626 Evas_Module *em = data;
627
628 em->definition->func.close(em);
629 em->loaded = 0;
630 return EINA_TRUE;
631}
632
610/* will dlclose all the modules loaded and free all the structs */ 633/* will dlclose all the modules loaded and free all the structs */
611void 634void
612evas_module_shutdown(void) 635evas_module_shutdown(void)
@@ -629,6 +652,11 @@ evas_module_shutdown(void)
629// eina_module_free(en); 652// eina_module_free(en);
630 } 653 }
631 654
655 eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_ENGINE], _cb_mod_close, NULL);
656 eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_IMAGE_LOADER], _cb_mod_close, NULL);
657 eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_IMAGE_SAVER], _cb_mod_close, NULL);
658 eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_OBJECT], _cb_mod_close, NULL);
659
632 eina_hash_free(evas_modules[EVAS_MODULE_TYPE_ENGINE]); 660 eina_hash_free(evas_modules[EVAS_MODULE_TYPE_ENGINE]);
633 evas_modules[EVAS_MODULE_TYPE_ENGINE] = NULL; 661 evas_modules[EVAS_MODULE_TYPE_ENGINE] = NULL;
634 eina_hash_free(evas_modules[EVAS_MODULE_TYPE_IMAGE_LOADER]); 662 eina_hash_free(evas_modules[EVAS_MODULE_TYPE_IMAGE_LOADER]);