Keep Open and Save asynchronous to prevent macOS resize crashes (#1127)
Open and Save use parented AsyncFileDialog sheets; their answers run on the UI thread in a later frame, so resizing the window while a picker is open no longer re-enters winit and aborts. Editors, tab changes, Close/Quit and model-changing control requests wait for the answer; the local library Open and Export in the Appearance dialog use the same flow. Fixes #1088.
This commit is contained in:
1 parent
f425089983
commit
37547f8eba
18 files changed
+564
-137
No files matched your search
@@ -136,16 +136,12 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
ui.horizontal(|ui| {
|
||||
ui.add(egui::TextEdit::singleline(&mut d.filter).hint_text(crate::i18n::tr_label("Filter")).desired_width(180.0));
|
||||
ui.separator();
|
||||
if ui.button("Import…").on_hover_text(crate::i18n::tr_label("CSV or JSON: updates existing parameters, adds new ones")).clicked()
|
||||
&& let Some(p) = app.services.pick_open.as_ref().and_then(|f| f())
|
||||
{
|
||||
d.error = app.run("parameters.import", json!({ "path": p })).err();
|
||||
if ui.button("Import…").on_hover_text(crate::i18n::tr_label("CSV or JSON: updates existing parameters, adds new ones")).clicked() {
|
||||
app.pick_open_command("parameters.import", json!({}));
|
||||
}
|
||||
for (label, ext) in [("Export CSV…", "csv"), ("Export JSON…", "json")] {
|
||||
if ui.button(label).clicked()
|
||||
&& let Some(p) = app.services.pick_save.as_ref().and_then(|f| f(&format!("parameters.{ext}"), &[ext]))
|
||||
{
|
||||
d.error = app.run("parameters.export", json!({ "path": p, "format": ext })).err();
|
||||
if ui.button(label).clicked() {
|
||||
app.pick_save_command(&format!("parameters.{ext}"), &[ext], "parameters.export", json!({"format": ext}));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user