fix(linux): workaround for crash on application exit due to Flutter implicit view removal#3339
fix(linux): workaround for crash on application exit due to Flutter implicit view removal#3339
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 |
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.