Skip to content

Commit dca815a

Browse files
committed
[desktop_webview_window] fix close sub window cause app exited
1 parent 40009bf commit dca815a

File tree

2 files changed

+74
-38
lines changed

2 files changed

+74
-38
lines changed

packages/desktop_multi_window/example/pubspec.lock

Lines changed: 65 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,56 @@ packages:
55
dependency: transitive
66
description:
77
name: async
8-
url: "https://pub.dartlang.org"
8+
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
9+
url: "https://pub.dev"
910
source: hosted
10-
version: "2.9.0"
11+
version: "2.11.0"
1112
boolean_selector:
1213
dependency: transitive
1314
description:
1415
name: boolean_selector
15-
url: "https://pub.dartlang.org"
16+
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
17+
url: "https://pub.dev"
1618
source: hosted
17-
version: "2.1.0"
19+
version: "2.1.1"
1820
characters:
1921
dependency: transitive
2022
description:
2123
name: characters
22-
url: "https://pub.dartlang.org"
24+
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
25+
url: "https://pub.dev"
2326
source: hosted
24-
version: "1.2.1"
27+
version: "1.3.0"
2528
clock:
2629
dependency: transitive
2730
description:
2831
name: clock
29-
url: "https://pub.dartlang.org"
32+
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
33+
url: "https://pub.dev"
3034
source: hosted
3135
version: "1.1.1"
3236
collection:
3337
dependency: transitive
3438
description:
3539
name: collection
36-
url: "https://pub.dartlang.org"
40+
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
41+
url: "https://pub.dev"
3742
source: hosted
38-
version: "1.16.0"
43+
version: "1.18.0"
3944
cupertino_icons:
4045
dependency: "direct main"
4146
description:
4247
name: cupertino_icons
43-
url: "https://pub.dartlang.org"
48+
sha256: "1989d917fbe8e6b39806207df5a3fdd3d816cbd090fac2ce26fb45e9a71476e5"
49+
url: "https://pub.dev"
4450
source: hosted
4551
version: "1.0.4"
4652
desktop_lifecycle:
4753
dependency: "direct main"
4854
description:
4955
name: desktop_lifecycle
50-
url: "https://pub.dartlang.org"
56+
sha256: "84587fc6b00c0363a1aaec592c60a2b3450ea8bf49ab5acee44926ae8e95452e"
57+
url: "https://pub.dev"
5158
source: hosted
5259
version: "0.1.0"
5360
desktop_multi_window:
@@ -61,7 +68,8 @@ packages:
6168
dependency: transitive
6269
description:
6370
name: fake_async
64-
url: "https://pub.dartlang.org"
71+
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
72+
url: "https://pub.dev"
6573
source: hosted
6674
version: "1.3.1"
6775
flutter:
@@ -73,7 +81,8 @@ packages:
7381
dependency: "direct dev"
7482
description:
7583
name: flutter_lints
76-
url: "https://pub.dartlang.org"
84+
sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493
85+
url: "https://pub.dev"
7786
source: hosted
7887
version: "1.0.4"
7988
flutter_test:
@@ -85,37 +94,42 @@ packages:
8594
dependency: transitive
8695
description:
8796
name: lints
88-
url: "https://pub.dartlang.org"
97+
sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c
98+
url: "https://pub.dev"
8999
source: hosted
90100
version: "1.0.1"
91101
matcher:
92102
dependency: transitive
93103
description:
94104
name: matcher
95-
url: "https://pub.dartlang.org"
105+
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
106+
url: "https://pub.dev"
96107
source: hosted
97-
version: "0.12.12"
108+
version: "0.12.16"
98109
material_color_utilities:
99110
dependency: transitive
100111
description:
101112
name: material_color_utilities
102-
url: "https://pub.dartlang.org"
113+
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
114+
url: "https://pub.dev"
103115
source: hosted
104-
version: "0.1.5"
116+
version: "0.5.0"
105117
meta:
106118
dependency: transitive
107119
description:
108120
name: meta
109-
url: "https://pub.dartlang.org"
121+
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
122+
url: "https://pub.dev"
110123
source: hosted
111-
version: "1.8.0"
124+
version: "1.9.1"
112125
path:
113126
dependency: transitive
114127
description:
115128
name: path
116-
url: "https://pub.dartlang.org"
129+
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
130+
url: "https://pub.dev"
117131
source: hosted
118-
version: "1.8.2"
132+
version: "1.8.3"
119133
sky_engine:
120134
dependency: transitive
121135
description: flutter
@@ -125,51 +139,66 @@ packages:
125139
dependency: transitive
126140
description:
127141
name: source_span
128-
url: "https://pub.dartlang.org"
142+
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
143+
url: "https://pub.dev"
129144
source: hosted
130-
version: "1.9.0"
145+
version: "1.10.0"
131146
stack_trace:
132147
dependency: transitive
133148
description:
134149
name: stack_trace
135-
url: "https://pub.dartlang.org"
150+
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
151+
url: "https://pub.dev"
136152
source: hosted
137-
version: "1.10.0"
153+
version: "1.11.1"
138154
stream_channel:
139155
dependency: transitive
140156
description:
141157
name: stream_channel
142-
url: "https://pub.dartlang.org"
158+
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
159+
url: "https://pub.dev"
143160
source: hosted
144-
version: "2.1.0"
161+
version: "2.1.2"
145162
string_scanner:
146163
dependency: transitive
147164
description:
148165
name: string_scanner
149-
url: "https://pub.dartlang.org"
166+
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
167+
url: "https://pub.dev"
150168
source: hosted
151-
version: "1.1.1"
169+
version: "1.2.0"
152170
term_glyph:
153171
dependency: transitive
154172
description:
155173
name: term_glyph
156-
url: "https://pub.dartlang.org"
174+
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
175+
url: "https://pub.dev"
157176
source: hosted
158177
version: "1.2.1"
159178
test_api:
160179
dependency: transitive
161180
description:
162181
name: test_api
163-
url: "https://pub.dartlang.org"
182+
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
183+
url: "https://pub.dev"
164184
source: hosted
165-
version: "0.4.12"
185+
version: "0.6.1"
166186
vector_math:
167187
dependency: transitive
168188
description:
169189
name: vector_math
170-
url: "https://pub.dartlang.org"
190+
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
191+
url: "https://pub.dev"
171192
source: hosted
172-
version: "2.1.2"
193+
version: "2.1.4"
194+
web:
195+
dependency: transitive
196+
description:
197+
name: web
198+
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
199+
url: "https://pub.dev"
200+
source: hosted
201+
version: "0.1.4-beta"
173202
sdks:
174-
dart: ">=2.17.0 <3.0.0"
203+
dart: ">=3.1.0-185.0.dev <4.0.0"
175204
flutter: ">=3.0.0"

packages/desktop_webview_window/linux/webview_window.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,18 @@ WebviewWindow::WebviewWindow(
115115
gtk_widget_show_all(GTK_WIDGET(window_));
116116
gtk_widget_grab_focus(GTK_WIDGET(webview_));
117117

118+
// FROM: https://github.com/leanflutter/window_manager/pull/343
119+
// Disconnect all delete-event handlers first in flutter 3.10.1, which causes delete_event not working.
120+
// Issues from flutter/engine: https://github.com/flutter/engine/pull/40033
121+
guint handler_id = g_signal_handler_find(window_, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, title_bar);
122+
if (handler_id > 0) {
123+
g_signal_handler_disconnect(window_, handler_id);
124+
}
118125
}
119126

120127
WebviewWindow::~WebviewWindow() {
121128
g_object_unref(method_channel_);
122-
g_debug("~WebviewWindow");
129+
printf("~WebviewWindow\n");
123130
}
124131

125132
void WebviewWindow::Navigate(const char *url) {
@@ -217,7 +224,7 @@ gboolean WebviewWindow::DecidePolicy(WebKitPolicyDecision *decision, WebKitPolic
217224

218225
void WebviewWindow::EvaluateJavaScript(const char *java_script, FlMethodCall *call) {
219226
webkit_web_view_evaluate_javascript(
220-
WEBKIT_WEB_VIEW(webview_), java_script,-1,nullptr,nullptr, nullptr,
227+
WEBKIT_WEB_VIEW(webview_), java_script, -1, nullptr, nullptr, nullptr,
221228
[](GObject *object, GAsyncResult *result, gpointer user_data) {
222229
auto *call = static_cast<FlMethodCall *>(user_data);
223230
GError *error = nullptr;

0 commit comments

Comments
 (0)