summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2018-06-19 13:42:16 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-06-19 13:42:16 -0400
commit023a9ca2ee32529849e770f057f58592956dee47 (patch)
treec49cf40487bfa3afcbbe91f0433c3842689c57b9
parenta43cb224c13bcc448fc489cc6fb30a4b53cff636 (diff)
downloadefl-023a9ca2ee32529849e770f057f58592956dee47.tar.gz
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
-rw-r--r--src/lib/eo/eo.c6
1 files changed, 6 insertions, 0 deletions
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)