-
Notifications
You must be signed in to change notification settings - Fork 10
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: don't proceed with ConfigureShorebird if init fails #87
Conversation
shell/common/shorebird/shorebird.cc
Outdated
@@ -125,8 +125,11 @@ void ConfigureShorebird(std::string code_cache_path, | |||
app_parameters.original_libapp_paths_size = c_paths.size(); | |||
|
|||
// shorebird_init copies from app_parameters and shorebirdYaml. | |||
shorebird_init(&app_parameters, ShorebirdFileCallbacks(), | |||
shorebird_yaml.c_str()); | |||
auto init_result = shorebird_init(&app_parameters, ShorebirdFileCallbacks(), |
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.
Is there any way to unit test this to ensure we don't have a regression?
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.
Won't this mean that only the first thread to call shorebird will have its snapshot replaced and all others will use the release snapshot?
I believe Firebase Cloud Messaging is an example of where a FlutterEngine is created (and executed) before the main thread is. I think this change as written would cause FCM to use the patch, but then the main app to use the release version? |
Ah, I had been testing with workmanager, which will be started by the app, but you're absolutely right (just confirmed in my FCM app test). I've updated to move the return further down, which will ensure the snapshot is properly set for the app in the FCM case. |
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.
This is the most surgical fix, and will probably work, but I think is probably not the right fix for this code long term. I left a long TODO to try and cover that.
Co-authored-by: Eric Seidel <eric@shorebird.dev>
* fix: don't proceed with ConfigureShorebird if init fails * move return further down * Update shell/common/shorebird/shorebird.cc Co-authored-by: Eric Seidel <eric@shorebird.dev> --------- Co-authored-by: Eric Seidel <eric@shorebird.dev>
* fix: don't proceed with ConfigureShorebird if init fails * move return further down * Update shell/common/shorebird/shorebird.cc Co-authored-by: Eric Seidel <eric@shorebird.dev> --------- Co-authored-by: Eric Seidel <eric@shorebird.dev>
* fix: don't proceed with ConfigureShorebird if init fails * move return further down * Update shell/common/shorebird/shorebird.cc Co-authored-by: Eric Seidel <eric@shorebird.dev> --------- Co-authored-by: Eric Seidel <eric@shorebird.dev>
If
shorebird_init
fails, don't proceed to report a launch start or start an update thread.Fixes shorebirdtech/updater#211