Skip to content

Commit fe9d9a9

Browse files
Implement GApplication:shutdown so a Flutter developer knows where to put code that should occur on application shutdown. (#136780)
This was added because the dispose method doesn't seem to be called - something must still have a reference to the application after shutdown. Solution for flutter/flutter#136582
1 parent 07d081b commit fe9d9a9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/flutter_tools/templates/app_shared/linux.tmpl/my_application.cc.tmpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ static gboolean my_application_local_command_line(GApplication* application, gch
8181
return TRUE;
8282
}
8383

84+
// Implements GApplication::shutdown.
85+
static void my_application_shutdown(GApplication* application) {
86+
//MyApplication* self = MY_APPLICATION(object);
87+
88+
// Perform any actions required at application shutdown.
89+
}
90+
8491
// Implements GObject::dispose.
8592
static void my_application_dispose(GObject* object) {
8693
MyApplication* self = MY_APPLICATION(object);
@@ -91,6 +98,7 @@ static void my_application_dispose(GObject* object) {
9198
static void my_application_class_init(MyApplicationClass* klass) {
9299
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
93100
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
101+
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
94102
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
95103
}
96104

0 commit comments

Comments
 (0)