[Tizen] Safety guard for BaseObject during SetProperty 52/306452/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 21 Feb 2024 12:43:32 +0000 (21:43 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Wed, 21 Feb 2024 12:59:43 +0000 (21:59 +0900)
It is possible to delete self during SetProperty.
To avoid this case, let we keep the handle during
SetProperty / OnSetProperty / PropertySetSignal emit.

TODO : Is SetProperty is the only case to be break down?

Change-Id: I7cb8249958914105a2cb8e8e3a44545f23948516
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/event/common/object-impl.cpp

index 590acbc..8859047 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -286,6 +286,7 @@ Property::Type Object::GetPropertyType(Property::Index index) const
 void Object::SetProperty(Property::Index index, Property::Value propertyValue)
 {
   DALI_ASSERT_ALWAYS(index > Property::INVALID_INDEX && "Property index is out of bounds");
+  Dali::Handle handle(this);
 
   bool propertySet(true);
 
@@ -388,7 +389,6 @@ void Object::SetProperty(Property::Index index, Property::Value propertyValue)
     OnPropertySet(index, propertyValue);
     if(!mPropertySetSignal.Empty())
     {
-      Dali::Handle handle(this);
       mPropertySetSignal.Emit(handle, index, propertyValue);
     }
   }