Skip to content
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

Add platform channel System.exitApplication and System.requestAppExit support #40033

Merged
merged 4 commits into from
Mar 10, 2023

Conversation

robert-ancell
Copy link
Contributor

@robert-ancell robert-ancell commented Mar 2, 2023

This adds support for System.exitApplication and sending and handling the response from System.requestAppExit to the platform channel.

Fixes Linux part of flutter/flutter#30735

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@robert-ancell robert-ancell marked this pull request as draft March 2, 2023 22:12
@robert-ancell
Copy link
Contributor Author

@gspencergoog I haven't tested this - can you confirm this is using the API as intended?

@robert-ancell
Copy link
Contributor Author

I've started platform plugin tests in #39992 - will land that first to use that framework.

@robert-ancell robert-ancell force-pushed the linux-exit-application branch 4 times, most recently from 4aca3ef to a189b31 Compare March 3, 2023 04:11
Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this all looks right now.

@robert-ancell robert-ancell marked this pull request as ready for review March 6, 2023 23:35
Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

shell/platform/linux/fl_platform_plugin.cc Outdated Show resolved Hide resolved
shell/platform/linux/fl_platform_plugin.cc Show resolved Hide resolved
@chinmaygarde
Copy link
Member

From Triage: May I land this?

@gspencergoog
Copy link
Contributor

I think not yet. Robert's still working out a segfault in the engine. Right @robert-ancell ?

@robert-ancell
Copy link
Contributor Author

Yes, I wanted to be sure the crash wasn't due to this change first.

@robert-ancell
Copy link
Contributor Author

Crash now fixed, will land once the tests complete.

@robert-ancell robert-ancell merged commit 62e6a65 into flutter:main Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 11, 2023
FlView* self) {
fl_platform_plugin_request_app_exit(self->platform_plugin);
// Stop the event from propagating.
return TRUE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line totally blocks the additional listener provided by plugins, such like window_manager. :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree, it does, but the alternative is returning FALSE, which would not give the app a chance to stop the exit when the last window goes away.

Perhaps this should only make the exit request and return TRUE if there is only one window open. That would still block the plugin listeners on the last window, though.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the change prevents *_plugin_dispose(GObject* object) from being called.

The some_plugin_dispose in the generated template will never be called.

static void some_plugin_dispose(GObject* object) {
  G_OBJECT_CLASS(some_plugin_parent_class)->dispose(object);
}

static void some_plugin_class_init(SomePluginClass* klass) {
  G_OBJECT_CLASS(klass)->dispose = some_plugin_dispose;
}

Kingtous added a commit to Kingtous/rustdesk_window_manager that referenced this pull request May 22, 2023
Kingtous added a commit to Kingtous/rustdesk_window_manager that referenced this pull request May 22, 2023
Kingtous added a commit to Kingtous/rustdesk_window_manager that referenced this pull request May 23, 2023
lijy91 pushed a commit to leanflutter/window_manager that referenced this pull request Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants