Skip to content

Commit 5b79075

Browse files
Fix Flet 0.23 crash on Ubuntu 22.04 (#3495)
Fix #3490
1 parent f0a47e1 commit 5b79075

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

client/.metadata

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: "db7ef5bf9f59442b0e200a90587e8fa5e0c6336a"
7+
revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1"
88
channel: "stable"
99

1010
project_type: app
@@ -13,11 +13,11 @@ project_type: app
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a
17-
base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a
18-
- platform: windows
19-
create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a
20-
base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a
16+
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
17+
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
18+
- platform: linux
19+
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
20+
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
2121

2222
# User provided section
2323

client/linux/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ set_target_properties(${BINARY_NAME}
8686
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
8787
)
8888

89+
8990
# Generated plugin build rules, which manage building the plugins and adding
9091
# them to the application.
9192
include(flutter/generated_plugins.cmake)
@@ -122,6 +123,12 @@ foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
122123
COMPONENT Runtime)
123124
endforeach(bundled_library)
124125

126+
# Copy the native assets provided by the build.dart from all packages.
127+
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
128+
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
129+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
130+
COMPONENT Runtime)
131+
125132
# Fully re-copy the assets directory on each build to avoid having stale files
126133
# from a previous install.
127134
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")

client/linux/my_application.cc

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static void my_application_activate(GApplication* application) {
4848
}
4949

5050
gtk_window_set_default_size(window, 1280, 720);
51-
gtk_widget_realize(GTK_WIDGET(window));
51+
gtk_widget_show(GTK_WIDGET(window));
5252

5353
g_autoptr(FlDartProject) project = fl_dart_project_new();
5454
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
@@ -81,6 +81,24 @@ static gboolean my_application_local_command_line(GApplication* application, gch
8181
return TRUE;
8282
}
8383

84+
// Implements GApplication::startup.
85+
static void my_application_startup(GApplication* application) {
86+
//MyApplication* self = MY_APPLICATION(object);
87+
88+
// Perform any actions required at application startup.
89+
90+
G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
91+
}
92+
93+
// Implements GApplication::shutdown.
94+
static void my_application_shutdown(GApplication* application) {
95+
//MyApplication* self = MY_APPLICATION(object);
96+
97+
// Perform any actions required at application shutdown.
98+
99+
G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application);
100+
}
101+
84102
// Implements GObject::dispose.
85103
static void my_application_dispose(GObject* object) {
86104
MyApplication* self = MY_APPLICATION(object);
@@ -91,6 +109,8 @@ static void my_application_dispose(GObject* object) {
91109
static void my_application_class_init(MyApplicationClass* klass) {
92110
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
93111
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
112+
G_APPLICATION_CLASS(klass)->startup = my_application_startup;
113+
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
94114
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
95115
}
96116

0 commit comments

Comments
 (0)