Fixed the crash appears after closing app when use ResizePolicy::USE_NATURAL_SIZE 01/265301/3
authorShrouq Sabah <s.sabah@samsung.com>
Thu, 14 Oct 2021 08:29:41 +0000 (11:29 +0300)
committershrouq Sabah <s.sabah@samsung.com>
Tue, 7 Dec 2021 07:31:48 +0000 (07:31 +0000)
commit19b72798b51883512932fbd1e84f35409b473277
treefe44cbdd6d42a8c1f0e426a414879965f17226a7
parentea175dc6974f482fa2657c6cff98b01d729d32ac
Fixed the crash appears after closing app when use ResizePolicy::USE_NATURAL_SIZE

There is a crash when destroying text-editor and the ResizePolicy is USE_NATURAL_SIZE.

textEditor.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::USE_NATURAL_SIZE);"
then close the application. the below exception appears.
ERROR: DALI: Assert (threadLocal) failed in: static Dali::Internal::ThreadLocalStorage& Dali::Internal::ThreadLocalStorage::Get()
Exception:
threadLocal
 thrown at static Dali::Internal::ThreadLocalStorage& Dali::Internal::ThreadLocalStorage::Get()
terminate called after throwing an instance of 'Dali::DaliException'

The solution applied at RelayoutController::Get().
Checked if ThreadLocalStorage is created then proceed normally otherwise returns null
Because the ThreadLocalStorage::Get() only retrieves STL without checking if it exists.

The caller of RelayoutController::Get() should check if RelayoutController is not null.
There is only one place use this function and already checks if RelayoutController is not null.

Change-Id: I343ef47f03aa86babb4bdd19f95c3e7ccb211dff
dali/internal/event/size-negotiation/relayout-controller-impl.cpp