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

V8PointerValue should not be GCed automatically. Fixes #2 #3

Merged
merged 1 commit into from
Jul 8, 2019

Conversation

Kudo
Copy link
Owner

@Kudo Kudo commented Jul 8, 2019

JSI uses PointerValue to allocate String, Object, ...etc,
and JSI controls life cycle itself from invalidate().
JSCRuntime did use JSValueUnprotect() to prevent these values being GCed.
For V8Runtime, we just need to keep they wrapped as v8::Glocal<> and not as weak.

For #2, the NativeModules.DialogManagerAndroid will first initialize correctly.
However, during the callback from Alert button clicked, If GC happened, some properties in NativeModules.DialogManagerAndroid may not exist and lead to exception.

Summary:
    JSI uses PointerValue to allocate String, Object, ...etc,
    and JSI controls life cycle itself from invalidate().
    JSCRuntime did use JSValueUnprotect() to prevent these values being GCed.
    For V8Runtime, we just need to keep they wrapped as v8::Glocal<> and not as weak.
@Kudo Kudo merged commit 87c8526 into master Jul 8, 2019
@Kudo Kudo deleted the fix_issue_2 branch July 8, 2019 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant