discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=023a9ca2ee32529849e770f057f58592956dee47

commit 023a9ca2ee32529849e770f057f58592956dee47
Author: Mike Blumenkrantz <[email protected]>
Date:   Tue Jun 19 13:42:16 2018 -0400

    eo: CRI when class constructor or destructor is called from thread
    
    Summary:
    calling the constructor and deconstructor from different threads
    causes issues with mempool deallocation, so ensure that the class is
    always initialized in the main thread for safety, e.g., call the
    SOME_NAMED_CLASS macro during init to instantiate the class
    
    fix T7003
    
    Reviewers: bu5hm4n, devilhorns
    
    Reviewed By: bu5hm4n
    
    Subscribers: cedric, #committers
    
    Tags: #efl
    
    Maniphest Tasks: T7003
    
    Differential Revision: https://phab.enlightenment.org/D6332
---
 src/lib/eo/eo.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 680dc1f016..37993784b4 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -1298,6 +1298,9 @@ _eo_class_constructor(_Efl_Class *klass)
 {
    klass->constructed = EINA_TRUE;
 
+   if (eina_thread_self() != _efl_object_main_thread)
+     CRI("Calling class constructor from non-main thread! This will crash 
later!");
+
    if (klass->desc->class_constructor)
      klass->desc->class_constructor(_eo_class_id_get(klass));
 }
@@ -1307,6 +1310,9 @@ eo_class_free(_Efl_Class *klass)
 {
    void *data;
 
+   if (eina_thread_self() != _efl_object_main_thread)
+     CRI("Calling class deconstructor from non-main thread! This will crash!");
+
    if (klass->constructed)
      {
         if (klass->desc->class_destructor)

-- 


Reply via email to