[NUI][API11] Remove DynamicProperty callback if URL changed + Make more thread safe...
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 9 Dec 2024 12:34:46 +0000 (21:34 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Tue, 10 Dec 2024 05:59:41 +0000 (14:59 +0900)
commit9d5f1465b6e73f2b612efc9c50483e8ac56f65b7
treecf37ee33d464b7d2a0a7e3318a342ff125615460
parent875d81c816ad214cf7f0ca3ebed537be7754afbc
[NUI][API11] Remove DynamicProperty callback if URL changed + Make more thread safe enough

Let us remove DynamicProperty callbacks if URL changes.
So far, we discard the callbacks if visual was changed.
But, the callbacks, which NUI stored, were not removed and remained alive
whenever we changed the URL.

Let us ensure their removal when URL changed (~= Visual Changed)

+

To avoid race condition, let we add lock feature before change `InternalSavedDynamicPropertyCallbacks`
(Since we can access this dictionary from various threads.) and make `weakReferencesOfLottie` as `ConcurrentDictionary` type.

Note : Since we need to iterate by `InternalSavedDynamicPropertyCallbacks.Keys` we need to use lock,
instead of `ConcurrentDictionary`.

TODO : There are some cases where we don't want to destroy registered callbacks. They will remain active in the future.
We make relative sample at `LottieAnimationViewDynamicPropertyTest.cs`. Let we pass `Test4` case show dynmaic property well.

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/LottieAnimationViewDynamicPropertyTest.cs