diff --git a/apps/ely-mark/src/export.rs b/apps/ely-mark/src/export.rs index e99d776..afcb4bf 100644 --- a/apps/ely-mark/src/export.rs +++ b/apps/ely-mark/src/export.rs @@ -125,32 +125,27 @@ impl Desk { let dir = ely_office::folder(tab).unwrap_or_else(std::env::temp_dir); let chosen = cx.prompt_for_new_path(&dir, Some(&format!("{stem}.{}", output.extension()))); cx.spawn(async move |desk, cx| { - // A cancel says nothing; a panel that failed says why. - let failed = match chosen.await { - Ok(Ok(Some(path))) => Ok(path), - Ok(Ok(None)) => return log::info!("mark: the export panel was cancelled"), + let chosen = match chosen.await { + Ok(Ok(path)) => Ok(path), Ok(Err(error)) => Err(error.to_string()), Err(error) => Err(error.to_string()), }; - let path = match failed { - Ok(path) => path, - Err(why) => { - if desk.update(cx, |desk, cx| desk.panel_failed(&why, cx)).is_err() { - log::error!("mark: the export panel failed after its window: {why}"); + let done = desk.update(cx, |desk, cx| match chosen { + Ok(Some(path)) => { + if let Err(error) = not_open(desk, &path) { + return desk.exported(Err(error), cx); + } + match output { + Output::Pdf => desk.render_pdf(id, Some(path), cx), + _ => desk.write_output(id, output, path, cx), } - return; } - }; - desk.update(cx, |desk, cx| { - if let Err(error) = not_open(desk, &path) { - return desk.exported(Err(error), cx); - } - match output { - Output::Pdf => desk.render_pdf(id, Some(path), cx), - _ => desk.write_output(id, output, path, cx), - } - }) - .ok(); + Ok(None) => log::info!("mark: the export panel was cancelled"), + Err(why) => desk.panel_failed(&why, cx), + }); + if done.is_err() { + log::info!("mark: the window closed before the export panel"); + } }) .detach(); } diff --git a/tasks/BUGS.md b/tasks/BUGS.md index aba3518..1946dc6 100644 --- a/tasks/BUGS.md +++ b/tasks/BUGS.md @@ -69,7 +69,7 @@ - [x] M-06 `on_app_quit` 无条件删恢复点与崩溃锁,AppKit 直接终止时丢未保存内容 — 未保存时退出只放下锁、不清点,窗口释放时不再删(审查 1 轮) - [x] M-07 崩溃恢复的未命名副本按“第一个显示的未命名标签”配对,内容可能落错标签 — 未命名副本按新建时记下的标签号配对,经 Keeping::take(审查 2 轮) - [x] M-08 页面重载后悬着的渲染回调永不完成,导出既不成功也不报错 — 页面失败后挂起与新到的渲染都以错误结束,载入成功才恢复(审查 2 轮) -- [ ] M-09 导出的保存面板出错被当作取消 +- [x] M-09 导出的保存面板出错被当作取消 — 面板出错走 panel_failed,取消只记日志(审查 1 轮) - [ ] M-10 关闭查找框只清当前标签的高亮 - [ ] M-11 页面把搜索词写进应用日志 - [ ] M-12 浏览器创建完成前 `WebView` 已释放,浏览器泄漏 diff --git a/tasks/reviews/M-09-r1.md b/tasks/reviews/M-09-r1.md new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/tasks/reviews/M-09-r1.md @@ -0,0 +1 @@ +PASS