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.
This commit is contained in:
Carsten Haitzler 2016-07-04 20:07:30 +09:00
parent 49f19a1cb2
commit 9527240d74
10 changed files with 43 additions and 13 deletions

View File

@ -439,13 +439,14 @@ ecore_shutdown(void)
eina_prefix_free(_ecore_pfx);
_ecore_pfx = NULL;
eo_unref(_ecore_parent);
eo_shutdown();
eina_shutdown();
#ifdef HAVE_EVIL
evil_shutdown();
#endif
eo_unref(_ecore_parent);
eo_shutdown();
end:
return _ecore_init_count;
}

View File

@ -360,6 +360,9 @@ efreet_cache_shutdown(void)
if (hnd_add) ecore_event_handler_del(hnd_add);
if (hnd_del) ecore_event_handler_del(hnd_del);
if (hnd_data) ecore_event_handler_del(hnd_data);
ecore_ipc_shutdown();
ipc = NULL;
pfx = NULL;
hnd_add = NULL;

View File

@ -64,6 +64,7 @@ embryo_shutdown(void)
eina_log_domain_unregister(_embryo_default_log_dom);
_embryo_default_log_dom = -1;
eina_shutdown();
return _embryo_init_count;
}

View File

@ -37,9 +37,6 @@ _evas_canvas3d_eet_file_get()
void
_evas_canvas3d_eet_file_init()
{
eina_init();
eet_init();
/* initialization of bonding between structure units in eet file */
Eet_Data_Descriptor_Class eddc;
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Evas_Canvas3D_Vec2_Eet);

View File

@ -43,6 +43,9 @@ evas_init(void)
if (!eina_init())
goto shutdown_evil;
if (!eet_init())
goto shutdown_eet;
_evas_log_dom_global = eina_log_domain_register
("evas_main", EVAS_DEFAULT_LOG_COLOR);
if (_evas_log_dom_global < 0)
@ -81,6 +84,8 @@ evas_init(void)
shutdown_module:
evas_module_shutdown();
eina_log_domain_unregister(_evas_log_dom_global);
shutdown_eet:
eet_shutdown();
shutdown_eina:
eina_shutdown();
shutdown_evil:
@ -145,6 +150,8 @@ evas_shutdown(void)
eina_log_domain_unregister(_evas_log_dom_global);
eet_shutdown();
eina_shutdown();
#ifdef HAVE_EVIL
evil_shutdown();

View File

@ -406,6 +406,13 @@ evas_module_unregister(const Evas_Module_Api *module, Evas_Module_Type type)
eina_array_data_set(evas_engines, em->id_engine - 1, NULL);
eina_hash_del(evas_modules[type], module->name, em);
if (em->loaded)
{
em->definition->func.close(em);
em->loaded = 0;
}
LKD(em->lock);
free(em);
@ -431,7 +438,11 @@ evas_module_find_type(Evas_Module_Type type, const char *name)
if ((unsigned int)type > 3) return NULL;
em = eina_hash_find(evas_modules[type], name);
if (em) return em;
if (em)
{
evas_module_load(em);
return em;
}
run_in_tree = !!getenv("EFL_RUN_IN_TREE");
@ -607,6 +618,18 @@ evas_module_clean(void)
static Eina_Prefix *pfx = NULL;
static Eina_Bool
_cb_mod_close(const Eina_Hash *hash EINA_UNUSED,
const void *key EINA_UNUSED,
void *data, void *fdata EINA_UNUSED)
{
Evas_Module *em = data;
em->definition->func.close(em);
em->loaded = 0;
return EINA_TRUE;
}
/* will dlclose all the modules loaded and free all the structs */
void
evas_module_shutdown(void)
@ -629,6 +652,11 @@ evas_module_shutdown(void)
// eina_module_free(en);
}
eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_ENGINE], _cb_mod_close, NULL);
eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_IMAGE_LOADER], _cb_mod_close, NULL);
eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_IMAGE_SAVER], _cb_mod_close, NULL);
eina_hash_foreach(evas_modules[EVAS_MODULE_TYPE_OBJECT], _cb_mod_close, NULL);
eina_hash_free(evas_modules[EVAS_MODULE_TYPE_ENGINE]);
evas_modules[EVAS_MODULE_TYPE_ENGINE] = NULL;
eina_hash_free(evas_modules[EVAS_MODULE_TYPE_IMAGE_LOADER]);

View File

@ -767,7 +767,6 @@ _ecore_imf_xim_init(void)
if (_ecore_imf_xim_log_dom < 0)
{
EINA_LOG_ERR("Could not register log domain: ecore_imf_xim");
return EINA_FALSE;
}
DBG(" ");

View File

@ -237,7 +237,6 @@ static int
module_open(Evas_Module *em)
{
if (!em) return 0;
eet_init();
em->functions = (void *)(&evas_image_load_eet_func);
return 1;
}
@ -245,7 +244,6 @@ module_open(Evas_Module *em)
static void
module_close(Evas_Module *em EINA_UNUSED)
{
eet_shutdown();
}
static Evas_Module_Api evas_modapi =

View File

@ -44,8 +44,6 @@ _read_data(float *array, int place, int count, char *current, float divider)
static inline Eina_Bool
_read_ply_header(char *map, Evas_Model_Load_Save_Header *header)
{
eina_init();
Eina_Bool reading_vertices = EINA_TRUE, check_next_char = EINA_FALSE;
int vertex_lines, triangles = 0, vertices_in_current_face = 0;
char **helping_pointer;

View File

@ -94,7 +94,6 @@ _write_obj_vertex_data(FILE *file,
Eina_Stringshare *str, *cur_str, *cur_index;
unsigned short cur_hu;
eina_init();
Eina_Hash *vb;
#define WRITE_OBJ_VERTEX_DATA(name, num, format) \
if (header.existence_of_##name) \
@ -126,7 +125,6 @@ _write_obj_vertex_data(FILE *file,
WRITE_OBJ_VERTEX_DATA(tex_coords, 2, "vt")
WRITE_OBJ_VERTEX_DATA(normals, 3, "vn")
#undef WRITE_OBJ_VERTEX_DATA
eina_shutdown();
}
static inline void