all efl object deletion functions now take NULL without crashing or erroring
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 24 Dec 2012 09:35:56 +0000 (09:35 +0000)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 24 Dec 2012 09:35:56 +0000 (09:35 +0000)
SVN revision: 81667

18 files changed:
ChangeLog
NEWS
src/lib/ecore/ecore_anim.c
src/lib/ecore/ecore_events.c
src/lib/ecore/ecore_exe.c
src/lib/ecore/ecore_idle_enterer.c
src/lib/ecore/ecore_idle_exiter.c
src/lib/ecore/ecore_idler.c
src/lib/ecore/ecore_job.c
src/lib/ecore/ecore_main.c
src/lib/ecore/ecore_pipe.c
src/lib/ecore/ecore_poll.c
src/lib/ecore/ecore_timer.c
src/lib/ecore_con/ecore_con.c
src/lib/ecore_evas/ecore_evas.c
src/lib/ecore_file/ecore_file_monitor.c
src/lib/ecore_ipc/ecore_ipc.c
src/lib/eio/eio_file.c

index 40f3016..3917ae1 100644 (file)
--- 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 3423f2e..a539c32 100644 (file)
--- 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.
index 4ae66a5..f155090 100644 (file)
@@ -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();
index 2d8ac1f..3405e3d 100644 (file)
@@ -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))
index 36347f6..b699656 100644 (file)
@@ -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))
    {
index 64956ad..ab0326a 100644 (file)
@@ -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();
index 8fd20e7..ac19dac 100644 (file)
@@ -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();
index 147b3c1..0f6af7d 100644 (file)
@@ -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();
index bc438b7..4ebdc63 100644 (file)
@@ -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;
index 069283a..9f53136 100644 (file)
@@ -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))
      {
index de7e5f4..1159e82 100644 (file)
@@ -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);
index 28be538..797fe84 100644 (file)
@@ -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
index 81a1ba2..7bde055 100644 (file)
@@ -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();
 
index 056db2e..a50b792 100644 (file)
@@ -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");
index 806fa03..7d4edae 100644 (file)
@@ -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,
index 6b6fb32..c7e5e8a 100644 (file)
@@ -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);
 }
index 2953bf0..6b5310f 100644 (file)
@@ -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,
index ffcd2a7..431d088 100644 (file)
@@ -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);
 }