Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NUI] Remove DynamicProperty callback if URL changed + Make more thread safe enough #6504

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

hinohie
Copy link
Contributor

@hinohie hinohie commented Dec 9, 2024

Let us remove DynamicProperty callbacks if URL changes.
So far, we discard the callbacks if the 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 the URL changes (~= Visual Changed)

To avoid race conditions, let's add a lock feature before changing InternalSavedDynamicPropertyCallbacks (Since we can access this dictionary from various threads.)

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.

@TizenAPI-Bot
Copy link
Collaborator

Build Error:

src/Tizen.NUI/src/public/BaseComponents/LottieAnimationView.cs(1663,24): error CS0246: The type or namespace name 'ConcurrentDictionary<,>' could not be found (are you missing a using directive or an assembly reference?) [src/Tizen.NUI/Tizen.NUI.csproj]

@dongsug-song
Copy link
Contributor

@hinohie
using System.Collections.Concurrent;
를 추가해서 빌드에러를 해결해야 할 것 같습니다. 감사합니다.

Copy link
Contributor

@Seoyeon2Kim Seoyeon2Kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the build error as Dongsug mentioned

@Seoyeon2Kim
Copy link
Contributor

@hinohie
I modified the description of this PR above. If there's incorrect modification, you can update it.
(For your information, "let's" == "let us")

@hinohie hinohie force-pushed the dynamic_bug branch 2 times, most recently from 3823df1 to 4a4ea4f Compare December 10, 2024 02:46
@hinohie hinohie changed the title [NUI] Remove DynamicProperty callback if URL changed + Make more thre… [NUI] Remove DynamicProperty callback if URL changed + Make more thread safe enough Dec 10, 2024
@hinohie
Copy link
Contributor Author

hinohie commented Dec 10, 2024

Hello @Seoyeon2Kim . Thank you for your comments. I check you change PR message more clear. It looks greate!

I applied the comments fix, and more, add some sample relative with this PR, and TODO.

…ad 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 <[email protected]>
Copy link
Contributor

@Seoyeon2Kim Seoyeon2Kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool to add more cases :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants