-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(6913): set/unset touchListener.owner onLoaded/onUnloaded #6922
fix(6913): set/unset touchListener.owner onLoaded/onUnloaded #6922
Conversation
The one of the existing tests failed with: JS: Test: --- [UTILS.test_releaseNativeObject_canBeCalledWithNativeObject] FAILED: __releaseNativeCounterpart is not defined, Stack: ReferenceError: __releaseNativeCounterpart is not defined I don't think I caused it, but cannot check the "All existing tests are passing:"-box. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to just use a WeakRef
for the owner
so that we don't have to worry about when and if we should clear it up. We do this in many other cases when there is a Listener
or Handler
object that is just used for a native callback (like here)
Hi @vakrilov That was something I wondered when I reported the issue. On iOS
NativeScript/tns-core-modules/ui/action-bar/action-bar.android.ts Lines 39 to 53 in 23147ae
That was why I choose not to use one. I'll update my PR as requested. |
test |
test |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
PR Checklist
What is the current behavior?
The
TouchListener
added toView
on android have a owner-reference that is never cleared like it is on other native classes like theclickListener
inbutton.android.ts
.So the
TouchListener
andView
will keep pointing to each other as seen in #6913.What is the new behavior?
Like on
clickListener
inbutton.android.ts
owner
is bound to thetouchListener
whenonLoaded
is called and removed again whenonUnloaded
is called.Fixes #6913