diff --git a/ChangeLog b/ChangeLog index 40f3016eac..3917ae1c56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2012-12-24 Mike Blumenkrantz * eina_magic_fail() now throws error messages on NULL pointers instead of critical + * all efl object-freeing functions now take NULL without crashing or erroring 2012-12-19 Gustavo Sverzut Barbieri (k-s) diff --git a/NEWS b/NEWS index 3423f2e745..a539c32253 100644 --- a/NEWS +++ b/NEWS @@ -63,6 +63,7 @@ Improvements: repeatedly calling malloc/free. * Display more information with eet -l -v. * eina_magic_fail() now throws error messages on NULL pointers instead of critical + * all efl object-freeing functions now take NULL without crashing or erroring Fixes: * Fix PPC (big endian) image codec bug. diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c index 4ae66a5a2f..f15509091c 100644 --- a/src/lib/ecore/ecore_anim.c +++ b/src/lib/ecore/ecore_anim.c @@ -398,6 +398,7 @@ ecore_animator_del(Ecore_Animator *obj) { void *data = NULL; + if (!obj) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); Ecore_Animator_Private_Data *animator = eo_data_get(obj, MY_CLASS); _ecore_lock(); diff --git a/src/lib/ecore/ecore_events.c b/src/lib/ecore/ecore_events.c index 2d8ac1f661..3405e3d62c 100644 --- a/src/lib/ecore/ecore_events.c +++ b/src/lib/ecore/ecore_events.c @@ -128,6 +128,7 @@ ecore_event_handler_del(Ecore_Event_Handler *event_handler) { void *data = NULL; + if (!event_handler) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); _ecore_lock(); if (!ECORE_MAGIC_CHECK(event_handler, ECORE_MAGIC_EVENT_HANDLER)) @@ -215,6 +216,7 @@ ecore_event_del(Ecore_Event *event) { void *data = NULL; + if (!event) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); _ecore_lock(); if (!ECORE_MAGIC_CHECK(event, ECORE_MAGIC_EVENT)) @@ -272,6 +274,7 @@ ecore_event_filter_del(Ecore_Event_Filter *ef) { void *data = NULL; + if (!ef) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); _ecore_lock(); if (!ECORE_MAGIC_CHECK(ef, ECORE_MAGIC_EVENT_FILTER)) diff --git a/src/lib/ecore/ecore_exe.c b/src/lib/ecore/ecore_exe.c index 36347f687d..b699656951 100644 --- a/src/lib/ecore/ecore_exe.c +++ b/src/lib/ecore/ecore_exe.c @@ -1068,6 +1068,7 @@ ecore_exe_free(Ecore_Exe *exe) int ok = 0; int result; + if (!exe) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) { diff --git a/src/lib/ecore/ecore_idle_enterer.c b/src/lib/ecore/ecore_idle_enterer.c index 64956ad7b7..ab0326a654 100644 --- a/src/lib/ecore/ecore_idle_enterer.c +++ b/src/lib/ecore/ecore_idle_enterer.c @@ -157,6 +157,7 @@ ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer) { void *data = NULL; + if (!idle_enterer) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); _ecore_lock(); diff --git a/src/lib/ecore/ecore_idle_exiter.c b/src/lib/ecore/ecore_idle_exiter.c index 8fd20e7a0a..ac19dac31d 100644 --- a/src/lib/ecore/ecore_idle_exiter.c +++ b/src/lib/ecore/ecore_idle_exiter.c @@ -110,6 +110,7 @@ ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter) { void *data; + if (!idle_exiter) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); _ecore_lock(); diff --git a/src/lib/ecore/ecore_idler.c b/src/lib/ecore/ecore_idler.c index 147b3c1880..0f6af7d9cd 100644 --- a/src/lib/ecore/ecore_idler.c +++ b/src/lib/ecore/ecore_idler.c @@ -91,6 +91,7 @@ ecore_idler_del(Ecore_Idler *idler) { void *data = NULL; + if (!idler) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); _ecore_lock(); diff --git a/src/lib/ecore/ecore_job.c b/src/lib/ecore/ecore_job.c index bc438b7209..4ebdc63f07 100644 --- a/src/lib/ecore/ecore_job.c +++ b/src/lib/ecore/ecore_job.c @@ -122,6 +122,7 @@ ecore_job_del(Ecore_Job *obj) { void *data; + if (!obj) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); Ecore_Job_Private_Data *job = eo_data_get(obj, MY_CLASS); data = job->data; diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c index 069283ac21..9f531361f9 100644 --- a/src/lib/ecore/ecore_main.c +++ b/src/lib/ecore/ecore_main.c @@ -1174,6 +1174,7 @@ ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler) { void *ret = NULL; + if (!fd_handler) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); _ecore_lock(); @@ -1193,6 +1194,7 @@ unlock: EAPI void * ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler) { + if (!win32_handler) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); if (!ECORE_MAGIC_CHECK(win32_handler, ECORE_MAGIC_WIN32_HANDLER)) { diff --git a/src/lib/ecore/ecore_pipe.c b/src/lib/ecore/ecore_pipe.c index de7e5f4e78..1159e82d8d 100644 --- a/src/lib/ecore/ecore_pipe.c +++ b/src/lib/ecore/ecore_pipe.c @@ -142,6 +142,7 @@ EAPI void * ecore_pipe_del(Ecore_Pipe *p) { void *r; + if (!p) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); _ecore_lock(); r = _ecore_pipe_del(p); diff --git a/src/lib/ecore/ecore_poll.c b/src/lib/ecore/ecore_poll.c index 28be53857c..797fe84572 100644 --- a/src/lib/ecore/ecore_poll.c +++ b/src/lib/ecore/ecore_poll.c @@ -392,6 +392,7 @@ ecore_poller_del(Ecore_Poller *obj) { void *data; + if (!obj) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); Ecore_Poller_Private_Data *poller = eo_data_get(obj, MY_CLASS); /* we are walking the poller list - a bad idea to remove from it while diff --git a/src/lib/ecore/ecore_timer.c b/src/lib/ecore/ecore_timer.c index 81a1ba2da0..7bde05561c 100644 --- a/src/lib/ecore/ecore_timer.c +++ b/src/lib/ecore/ecore_timer.c @@ -272,6 +272,7 @@ ecore_timer_del(Ecore_Timer *timer) { void *data = NULL; + if (!timer) return NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); _ecore_lock(); diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index 056db2eec0..a50b792e0d 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -552,6 +552,7 @@ ecore_con_server_timeout_get(Ecore_Con_Server *svr) EAPI void * ecore_con_server_del(Ecore_Con_Server *svr) { + if (!svr) return NULL; if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) { ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_del"); @@ -854,6 +855,7 @@ ecore_con_client_timeout_get(Ecore_Con_Client *cl) EAPI void * ecore_con_client_del(Ecore_Con_Client *cl) { + if (!cl) return NULL; if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) { ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_del"); diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 806fa03e3a..7d4edaef42 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -699,6 +699,7 @@ ecore_evas_ecore_evas_get(const Evas *e) EAPI void ecore_evas_free(Ecore_Evas *ee) { + if (!ee) return; if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, diff --git a/src/lib/ecore_file/ecore_file_monitor.c b/src/lib/ecore_file/ecore_file_monitor.c index 6b6fb32349..c7e5e8a3af 100644 --- a/src/lib/ecore_file/ecore_file_monitor.c +++ b/src/lib/ecore_file/ecore_file_monitor.c @@ -67,6 +67,7 @@ ecore_file_monitor_add(const char *path, EAPI void ecore_file_monitor_del(Ecore_File_Monitor *em) { + if (!em) return; EINA_SAFETY_ON_NULL_RETURN(em); ecore_file_monitor_backend_del(em); } diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c index 2953bf0eac..6b5310f968 100644 --- a/src/lib/ecore_ipc/ecore_ipc.c +++ b/src/lib/ecore_ipc/ecore_ipc.c @@ -458,6 +458,7 @@ ecore_ipc_server_del(Ecore_Ipc_Server *svr) { void *data; + if (!svr) return NULL; if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) { ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER, @@ -874,6 +875,7 @@ ecore_ipc_client_del(Ecore_Ipc_Client *cl) void *data; Ecore_Ipc_Server *svr; + if (!cl) return NULL; if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT)) { ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT, diff --git a/src/lib/eio/eio_file.c b/src/lib/eio/eio_file.c index ffcd2a73ad..431d088e69 100644 --- a/src/lib/eio/eio_file.c +++ b/src/lib/eio/eio_file.c @@ -846,6 +846,7 @@ eio_file_stat_ls(const char *dir, EAPI Eina_Bool eio_file_cancel(Eio_File *ls) { + if (!ls) return EINA_FALSE; EINA_SAFETY_ON_NULL_RETURN_VAL(ls, EINA_FALSE); return ecore_thread_cancel(ls->thread); }