BlueGit

ict rusty-teams

fix(cards): URL task dialogs no longer crash the app on Windows

Opening the dialog read AppState while the card action was still updating it.
The panic could not unwind through the window procedure and aborted the app.
The caller now hands the engine over instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-10-08 · 7 weeks ago

Hash
14aa9993d4e2f009d90d2d1bbd0ff1468fdf06d2
Parent
e756946f
3 files changed +8 −5
crates/app/src/card_actions.rs +1 −0
@@ -315,6 +315,7 @@ impl AppState {
315 315 scope: scope.clone(),
316 316 web_application_resource,
317 317 },
318 self.engine.clone(),
318 319 cx,
319 320 );
320 321 if in_dialog {
@@ -315,6 +315,7 @@ impl AppState {
315 scope: scope.clone(),
315 scope: scope.clone(),
316 web_application_resource,
316 web_application_resource,
317 },
317 },
318 self.engine.clone(),
318 cx,
319 cx,
319 );
320 );
320 if in_dialog {
321 if in_dialog {
crates/app/src/task_dialog.rs +6 −3
@@ -1,5 +1,8 @@
1 use std::sync::Arc;
2
1 3 use gpui_kit::*;
2 4
5 use crate::backend::Engine;
3 6 use crate::card_state::CardScope;
4 7
5 8 #[cfg(windows)]
@@ -36,11 +39,11 @@ pub enum UrlDialogNext {
36 39 }
37 40
38 41 #[cfg(windows)]
39 pub fn open_url_dialog(dialog: UrlDialog, cx: &mut App) {
40 hosted::open(dialog, cx);
42 pub fn open_url_dialog(dialog: UrlDialog, engine: Option<Arc<Engine>>, cx: &mut App) {
43 hosted::open(dialog, engine, cx);
41 44 }
42 45
43 46 #[cfg(not(windows))]
44 pub fn open_url_dialog(dialog: UrlDialog, cx: &mut App) {
47 pub fn open_url_dialog(dialog: UrlDialog, _engine: Option<Arc<Engine>>, cx: &mut App) {
45 48 cx.open_url(&dialog.fallback_url);
46 49 }
@@ -1,5 +1,8 @@
1use std::sync::Arc;
2
1use gpui_kit::*;
3use gpui_kit::*;
2
4
5use crate::backend::Engine;
3use crate::card_state::CardScope;
6use crate::card_state::CardScope;
4
7
5#[cfg(windows)]
8#[cfg(windows)]
@@ -36,11 +39,11 @@ pub enum UrlDialogNext {
36}
39}
37
40
38#[cfg(windows)]
41#[cfg(windows)]
39pub fn open_url_dialog(dialog: UrlDialog, cx: &mut App) {
42pub fn open_url_dialog(dialog: UrlDialog, engine: Option<Arc<Engine>>, cx: &mut App) {
40 hosted::open(dialog, cx);
43 hosted::open(dialog, engine, cx);
41}
44}
42
45
43#[cfg(not(windows))]
46#[cfg(not(windows))]
44pub fn open_url_dialog(dialog: UrlDialog, cx: &mut App) {
47pub fn open_url_dialog(dialog: UrlDialog, _engine: Option<Arc<Engine>>, cx: &mut App) {
45 cx.open_url(&dialog.fallback_url);
48 cx.open_url(&dialog.fallback_url);
46}
49}
crates/app/src/task_dialog/hosted.rs +1 −2
@@ -17,13 +17,12 @@ pub fn install_host(transport: Arc<WebViewTransport>) {
17 17 let _ = HOST.set(transport);
18 18 }
19 19
20 pub fn open(dialog: UrlDialog, cx: &mut App) {
20 pub fn open(dialog: UrlDialog, engine: Option<Arc<Engine>>, cx: &mut App) {
21 21 let Some(host) = HOST.get().cloned() else {
22 22 cx.open_url(&dialog.fallback_url);
23 23 return;
24 24 };
25 25 let state = cx.global::<AppHandle>().0.clone();
26 let engine = state.read(cx).engine.clone();
27 26 let owner = cx
28 27 .active_window()
29 28 .and_then(|window| {
@@ -17,13 +17,12 @@ pub fn install_host(transport: Arc<WebViewTransport>) {
17 let _ = HOST.set(transport);
17 let _ = HOST.set(transport);
18}
18}
19
19
20pub fn open(dialog: UrlDialog, cx: &mut App) {
20pub fn open(dialog: UrlDialog, engine: Option<Arc<Engine>>, cx: &mut App) {
21 let Some(host) = HOST.get().cloned() else {
21 let Some(host) = HOST.get().cloned() else {
22 cx.open_url(&dialog.fallback_url);
22 cx.open_url(&dialog.fallback_url);
23 return;
23 return;
24 };
24 };
25 let state = cx.global::<AppHandle>().0.clone();
25 let state = cx.global::<AppHandle>().0.clone();
26 let engine = state.read(cx).engine.clone();
27 let owner = cx
26 let owner = cx
28 .active_window()
27 .active_window()
29 .and_then(|window| {
28 .and_then(|window| {