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
[breaking change] [vm/ffi] Closed NativeCallable
s nativeFunction
should throw instead of return nullptr
#53311
Comments
cc @lrhn as well |
Did you mean to cc @liamappelbe instead of |
@dcharkes a few things here:
@vsmenon @Hixie @grouma reaching out for breaking change review. |
This should be a fairly minimal change I believe. @liamappelbe
The next release. |
Seems reasonable. |
Hey, since we're doing this change, I would also add that the close function should also return silently if the Native Callable is already closed. (the alternative of throwing would probably work, but we don't want to encourage users to catch StateErrors). |
As you say, we don't want to encourage people to catch an Otherwise, lgtm. |
If just let |
@grouma any thoughts on this change? |
ACX doesn't make use of ffi so we are agnostic to this change. Looks like one customer has very minor usage and should not be impacted. |
EDIT: After discussions on the PR, decided to make the
I'm not |
Change Intent
->
Justification
@mkustermann in https://dart-review.googlesource.com/c/sdk/+/317060/20/sdk/lib/ffi/ffi.dart#225
cc @liama
Impact
I believe the impact to be minimal, because it's quite unlikely that nullptr is already used by people in native code to check that some native callable is closed. Also, native callable has only been in stable for a week.
Mitigation
Users can wrap the access in a try-catch and return nullptr (however one shouldn't catch
StateError
s).If we want to provide a cleaner solution we should maybe add a
bool get closed
to query whether the callable has been closed.The text was updated successfully, but these errors were encountered: