From 6966f8760c8757afb3c15ea1277e0bfc8c27852f Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Wed, 18 Jan 2023 15:46:16 +0900 Subject: [PATCH] [Tizen] Assert when proprety notification is used in a thread other than the main thread Change-Id: I9b2f6c1f70327c5289f1e9476d48876d5ecd762b --- dali/internal/event/common/event-thread-services.cpp | 4 ++-- dali/internal/event/common/property-notification-impl.cpp | 9 +++++---- dali/internal/event/common/thread-local-storage.cpp | 4 ++-- dali/internal/event/common/thread-local-storage.h | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/dali/internal/event/common/event-thread-services.cpp b/dali/internal/event/common/event-thread-services.cpp index 4bcbda5..87a42a8 100644 --- a/dali/internal/event/common/event-thread-services.cpp +++ b/dali/internal/event/common/event-thread-services.cpp @@ -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 diff --git a/dali/internal/event/common/property-notification-impl.cpp b/dali/internal/event/common/property-notification-impl.cpp index 648bf97..4cd78d3 100644 --- a/dali/internal/event/common/property-notification-impl.cpp +++ b/dali/internal/event/common/property-notification-impl.cpp @@ -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 #include #include -#include #include #include #include @@ -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; diff --git a/dali/internal/event/common/thread-local-storage.cpp b/dali/internal/event/common/thread-local-storage.cpp index 25b3d06..8c18dd0 100644 --- a/dali/internal/event/common/thread-local-storage.cpp +++ b/dali/internal/event/common/thread-local-storage.cpp @@ -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; } diff --git a/dali/internal/event/common/thread-local-storage.h b/dali/internal/event/common/thread-local-storage.h index 3f56fdf..b6a4405 100644 --- a/dali/internal/event/common/thread-local-storage.h +++ b/dali/internal/event/common/thread-local-storage.h @@ -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 -- 2.7.4