-
Notifications
You must be signed in to change notification settings - Fork 239
fix(linux): workaround for crash on application exit due to Flutter implicit view removal #3339
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
base: dev
Are you sure you want to change the base?
Conversation
- Updated the window close handler to manage exit behavior on Linux, ensuring graceful shutdown without GTK cleanup issues. - Added a delete-event signal handler to intercept window close events on Linux, allowing for proper dialog handling before exiting. - Introduced a stub for the exit function on the web platform to prevent unsupported calls.
- Removed unused flutter_view member from the MyApplication struct and related functions to clean up the code. - This change simplifies the application structure and addresses potential memory management concerns.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Visit the preview URL for this PR (updated for commit 02dad90): https://walletrc--pull-3339-merge-5tjokbjf.web.app (expires Sun, 09 Nov 2025 22:05:42 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc |
smk762
left a comment
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.
Confirmed the mentioned error is no longer present in logs upon exit. When not logged in, linux exits cleanly.
When exiting while logged in, an unrelated error appears - #3341
The error you described isn't related to this PR. It also appears on the latest followed by: The purpose of this PR is to fix the last error. It does not address the |
On Linux, closing the application window resulted in a crash with the following errors:
embedder.cc (2572): 'FlutterEngineRemoveView' returned 'kInvalidArguments'. Remove view info was invalid. The implicit view cannot be removed.** (KomodoWallet): CRITICAL **: FlOpenGLManager *fl_engine_get_opengl_manager(FlEngine *): assertion 'FL_IS_ENGINE(self)' failedSegmentation fault (core dumped)Solution
Implemented a workaround that bypasses GTK's standard cleanup chain by calling
exit(0)directly:Dart layer (
window_close_handler.dart):flutter_window_closefor the confirmation dialogfalsefrom the close handler to preventflutter_window_closefrom closing the window via GTKexit(0)after a short delay (200ms) to allow cleanup to complete, bypassing GTK cleanup that triggers the crashNative layer (
my_application.cc):delete-eventhandler that returnsFALSEto allow the event to propagate toflutter_window_closePlatform compatibility:
dart:ioexit function to ensure web builds compile correctlyChanges
lib/sdk/widgets/window_close_handler.dartto handle Linux exit manually viaexit(0)window_close_handler_exit_stub.dart)linux/my_application.ccwithdelete-eventhandlerflutter_viewfield fromMyApplicationstructNote
exit(0)to bypass GTK cleanup is not an ideal approach, as it:This workaround should be replaced with a more proper solution once a fix becomes available / better approach is discovered. The current solution is a temporary measure to prevent application crashes on Linux.