Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

The Open/Save window closes when the window that asked for it is gone

gelenmedyaf3179cfc3f59
diff --git a/crates/rf-app/src/picker.rs b/crates/rf-app/src/picker.rs
index 19f7eb6a..220109f3 100644
--- a/crates/rf-app/src/picker.rs
+++ b/crates/rf-app/src/picker.rs
@@ -440,9 +440,35 @@ fn open_window(pipe: File, req: Request, cx: &mut App) {
ws
})
});
- if let Err(e) = opened {
- log::error!("picker window: {e:#}");
- return;
+ let picker = match opened {
+ Ok(picker) => picker,
+ Err(e) => {
+ log::error!("picker window: {e:#}");
+ return;
+ }
+ };
+ // The app that asked can go away while its dialog is up (it crashed, or was ended): its window goes with it, and the dialog
+ // stayed on the screen with nobody left to answer (seen on 2026-12-04, with a test program closed under its Open dialog: two
+ // such windows were still there minutes later). Windows closes a dialog with its owner; ours belongs to another process, so
+ // it looks for the owner itself and leaves with it.
+ if owner != 0 {
+ let shown = shown_hwnd.clone();
+ cx.spawn(async move |cx| {
+ loop {
+ cx.background_executor().timer(std::time::Duration::from_millis(500)).await;
+ let hwnd = shown.get();
+ if hwnd != 0 && !rf_win::window::exists(hwnd) {
+ break;
+ }
+ if !rf_win::window::exists(owner) {
+ dialog_log("app picker: the window that asked is gone, the picker closes");
+ let (handle, workspace) = &picker;
+ let _ = handle.update(cx, |_, window, cx| workspace.update(cx, |ws, _| cancel(ws, window)));
+ break;
+ }
+ }
+ })
+ .detach();
}
// Asked from a background process (Chrome's file dialog helper), Windows may refuse the
// switch while the window is still being shown: try again once it is on screen.