-
Notifications
You must be signed in to change notification settings - Fork 72
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
App crashes when passing in an empty Vec<u8>
#165
Comments
Will inspect this soon, thanks for the report :) |
This looks like an issue with // native/hub/Cargo.toml
...
allo-isolate = { version = "0.1.19", features = [] }
... For the time being, you can use this framework with that feature removed from |
New version 4.2.1 published just now has fixed this bug, and I've also confirmed that it works well with your code. Try installing the new version and running I've also made a PR at allo-isolate that addresses this issue. However, RIF 4.2.1 solves this issue in our own way. Thank you for telling us, and feel free to come back for any other discussions :) |
Hellow again @temeddix The fix seems to work with the minimal example but still breaks in my real app. And I think I know why let response_message = messages::reset_action::ResetActionResult {};
let empty_response = RustResponse {
successful: true,
message: Some(response_message.encode_to_vec()),
blob: None,
}; I noticed the fix you put in was to send a None instead of a Some(Vec::new()). In my case It seems since I'm sending an encoded struct that is empty, it's just an empty vec? (ResetActionResult is just an empty struct) |
Yeah, you've got the right point. Right now, |
No worries. If allo-isolate gets fixed eventually workarounds are fine for now. I'm actually just going to send a None there. This issue has made me realize I don't need the ResetActionResult type at all. Thanks for the quick response |
No problem :) On the other hand, I will keep this issue open until we have the new version of |
Vec<T>
Vec<T>
Vec<u8>
Now |
Awesome. Glad the issue got uncovered and fixed. |
@temeddix /// Response object that is sent from Rust to Dart.
#[derive(Clone)]
pub struct RustResponse {
pub successful: bool,
pub message: Option<Vec<u8>>,
pub blob: Option<Vec<u8>>,
}
impl Default for RustResponse {
/// Empty response with the successful value of false.
fn default() -> RustResponse {
RustResponse {
successful: false,
message: Some(Vec::new()),
blob: Some(Vec::new()),
}
}
} It's maybe better to have |
You're on an older version. It's been fixed already. |
Report
I'm trying to make an app where I fire and forget a RustRequest, and rust returns DefaultResponse but also responds with a signal. I'm using that signal in a StreamBuilder to rebuild a widget, sort of like a state machine.
Seems to work fine in Web, but android apk seems to fail after a while. App will work fine for some seconds and then crash.
Also what's the best way to debug this?
Steps to Reproduce
Minimal example
action.proto
state.proto
main.dart
with_request.rs
System Information
The text was updated successfully, but these errors were encountered: