ecore: fix Ecore_Thread double free and update ChangeLog/NEWS.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 10 Mar 2012 12:47:54 +0000 (12:47 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 10 Mar 2012 12:47:54 +0000 (12:47 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@69172 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
NEWS
src/lib/ecore/ecore_thread.c

index ad6662a..fc7bda8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 2012-03-07  Mike Blumenkrantz (discomfitor/zmike)
 
         * Add ecore_con_url_status_code_get() to check return code at any time
+
+2012-03-09  Carsten Haitzler (The Rasterman)
+
+       * Fix ecore_thread_feedback_run to work as the documentation and logic tell us.
+
+2012-03-10  Cedric Bail
+
+       * Fix double free at end of execution of Ecore_Thread with feedback.
diff --git a/NEWS b/NEWS
index 346bc0b..d8c5d94 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,11 @@ Additions:
      - ecore_imf_context_input_panel_caps_lock_mode_set()
      - ecore_imf_context_input_panel_caps_lock_mode_get()
 
+Fixes:
+    * ecore_thread:
+     - ecore_thread_feedback_run now handle try_no_queue the way it logically should.
+     - prevent double free that could cause crash when an Ecore_Thread stop.
+
 Improvements:
     * ecore:
      - most allocations moved to mempools
index 901d4b3..55ef2ae 100644 (file)
@@ -528,6 +528,7 @@ _ecore_feedback_job(PH(thread))
 static void *
 _ecore_direct_worker(Ecore_Pthread_Worker *work)
 {
+   Ecore_Pthread_Worker *end;
    Ecore_Pthread_Data *pth;
 
 #ifdef EFL_POSIX_THREADS
@@ -548,33 +549,39 @@ _ecore_direct_worker(Ecore_Pthread_Worker *work)
    else
      work->u.feedback_run.func_heavy((void *) work->data, (Ecore_Thread *) work);
 
-   ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
-
    if (work->message_run)
-     work = work->u.message_run.direct_worker;
+     {
+        end = work->u.message_run.direct_worker;
+        work->u.message_run.direct_worker = NULL;
+     }
    else
-     work = work->u.feedback_run.direct_worker;
-   if (!work)
+     {
+        end = work->u.feedback_run.direct_worker;
+        work->u.feedback_run.direct_worker = NULL;
+     }
+
+   ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
+
+   if (!end)
      {
         free(pth);
         return NULL;
      }
 
-   work->data = pth;
-   work->u.short_run.func_blocking = NULL;
-   work->func_end = (void *)_ecore_thread_end;
-   work->func_cancel = NULL;
-   work->cancel = EINA_FALSE;
-   work->feedback_run = EINA_FALSE;
-   work->message_run = EINA_FALSE;
-   work->no_queue = EINA_FALSE;
-   work->kill = EINA_FALSE;
-   work->hash = NULL;
-   LKI(work->mutex);
-   CDI(work->cond, work->mutex);
-
-// don't queue this - this is deleted by _ecore_thread_kill() already deleting work->u.feedback_run.direct_worker
-//   ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
+   end->data = pth;
+   end->u.short_run.func_blocking = NULL;
+   end->func_end = (void *)_ecore_thread_end;
+   end->func_cancel = NULL;
+   end->cancel = EINA_FALSE;
+   end->feedback_run = EINA_FALSE;
+   end->message_run = EINA_FALSE;
+   end->no_queue = EINA_FALSE;
+   end->kill = EINA_FALSE;
+   end->hash = NULL;
+   LKI(end->mutex);
+   CDI(end->cond, end->mutex);
+
+   ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, end);
 
    return NULL;
 }