[Tizen] Assert when proprety notification is used in a thread other than the main... 13/287013/1
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 18 Jan 2023 06:46:16 +0000 (15:46 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Wed, 18 Jan 2023 08:53:35 +0000 (17:53 +0900)
Change-Id: I9b2f6c1f70327c5289f1e9476d48876d5ecd762b

dali/internal/event/common/event-thread-services.cpp
dali/internal/event/common/property-notification-impl.cpp
dali/internal/event/common/thread-local-storage.cpp
dali/internal/event/common/thread-local-storage.h

index 4bcbda5..87a42a8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ bool EventThreadServices::IsCoreRunning()
 
 bool EventThreadServices::IsShuttingDown()
 {
-  return ThreadLocalStorage::IsSuttingDown();
+  return ThreadLocalStorage::IsShuttingDown();
 }
 
 } // namespace Internal
index 648bf97..4cd78d3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/common/object-impl.h>
 #include <dali/internal/event/common/property-notification-manager.h>
-#include <dali/internal/event/common/stage-impl.h>
 #include <dali/internal/event/common/thread-local-storage.h>
 #include <dali/internal/update/common/scene-graph-property-notification.h>
 #include <dali/internal/update/manager/update-manager.h>
@@ -122,7 +121,7 @@ PropertyNotification::~PropertyNotification()
   Disable();
 
   // Guard to disallow use of PropertyNotificationManager after Core has been destroyed
-  if(Stage::IsInstalled())
+  if(!EventThreadServices::IsShuttingDown())
   {
     // Disconnect from the property notification manager
     mPropertyNotificationManager.PropertyNotificationDestroyed(*this);
@@ -149,7 +148,7 @@ void PropertyNotification::Enable()
 void PropertyNotification::Disable()
 {
   // Guard to allow handle destruction after Core has been destroyed
-  if(Stage::IsInstalled())
+  if(!EventThreadServices::IsShuttingDown())
   {
     // Stop scene-graph from monitoring the target's properties.
     DestroySceneObject();
@@ -225,6 +224,8 @@ void PropertyNotification::DestroySceneObject()
 {
   if(mPropertyNotification != nullptr)
   {
+    DALI_ASSERT_ALWAYS(EventThreadServices::IsCoreRunning());
+
     // Remove PropertyNotification using a message to the update manager
     RemovePropertyNotificationMessage(mUpdateManager, *mPropertyNotification);
     mPropertyNotification = nullptr;
index 25b3d06..8c18dd0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -94,7 +94,7 @@ bool ThreadLocalStorage::Created()
   return (threadLocal != nullptr);
 }
 
-bool ThreadLocalStorage::IsSuttingDown()
+bool ThreadLocalStorage::IsShuttingDown()
 {
   return isShuttingDown;
 }
index 3f56fdf..b6a4405 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_THREAD_LOCAL_STORAGE_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -93,7 +93,7 @@ public:
    * Checks if the system is shutting down
    * @return true if the system is shutting down
    */
-  static bool IsSuttingDown();
+  static bool IsShuttingDown();
 
   /**
    * Get a pointer to the TLS or NULL if not initialized