-
Notifications
You must be signed in to change notification settings - Fork 89
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
Use Finalizable to ensure lexical liveness #754
Conversation
16abbf2
to
72ab64e
Compare
26769d1
to
5938b56
Compare
This looks reasonable, but still seems kind of hacky. I'm worried that a linker static analysis can discover those methods are unused and strip them from the compiled application. I'm not sure how much (if any) code stripping the dart linker does, especially when compiling to native, but it'd be interesting to confirm with the dart team this is the idiomatic approach for what we're trying to do. |
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.
Added some suggestions. Also seems containing some debug left overs.
See reply by dartlang developer here: dart-lang/sdk#49643 (comment)
|
BTW, in case it isn't obvious. The need to have these |
af44b59
to
973aa18
Compare
3b895fb
to
999f547
Compare
Classes that implements Finalizable: * App, * FlexibleSyncConfiguration, * HandleBase, * Realm, * RealmEntity, * RealmList, * RealmResults, * Subscription, * SubscriptionSet, and * User, The corresponding XInternal extension classes implements a keepAlive function to ensure finalizable fields always live as long as their finalizable parent. This is workaround for: dart-lang/sdk#49643 Resolves: #581, resolves: #582
* RealmObject, * RealmObjectChanges, and * RealmCollectionChanges. Drop from RealmEntity
…n trace. Instead have const flag and depend on tree-shaking
999f547
to
e8b7cc9
Compare
We need to use the new
Finalizable
marker interface to ensure that native handles survive long enough. However, since Finalizables don't keep member finalizables alive, we also need to add a bunch of pseudokeepAlive
extension methods, that are not exposed to the user, and only exists to teach the compiler about the lifetime dependencies of the variousFinalizable
s.Resolves: #581, resolves: #582