Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Merge gpu-startup: recovered documents survive restarts, the watchdog only restarts a hung adapter, software adapters last, the skip list as an argument

aionggfbfd0b2fe9c3
diff --cc apps/designcraft/src/main.rs
index b4a1d7211,196cc32ff..0b527f095
--- a/apps/designcraft/src/main.rs
+++ b/apps/designcraft/src/main.rs
@@@ -55,11 -60,9 +60,13 @@@ impl eframe::App for App
self.app.raw_input_hook(raw);
}
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
+ self.startup.enter();
self.app.ui(ui);
+ #[cfg(target_os = "macos")]
+ if self.app.take_ime_discard() {
+ discard_marked_text();
+ }
+ self.startup.leave();
}
fn on_exit(&mut self) {
// A normal exit before the third frame is not a crash.
diff --cc crates/engine/src/recovery.rs
index 1011e1396,d63bfe9b6..91135c7cb
--- a/crates/engine/src/recovery.rs
+++ b/crates/engine/src/recovery.rs
@@@ -229,9 -236,16 +236,16 @@@ pub fn open(s: &mut Session, dir: &Path
st.fonts = fonts;
// Unsaved: the copy on disk (if any) is older than what was recovered.
st.saved_doc = std::sync::Arc::new((*st.doc).clone());
- st.revision += 1;
+ st.bump_revision();
- opened.push(s.add_document(st));
- discard(dir, uid);
+ let index = s.add_document(st);
+ opened.push(index);
+ // An entry that can't be rewritten stays under its old uid: a duplicate on the next
+ // recovery is better than a lost document.
+ match s.docs.get(index).map(|d| write_entry(dir, d)) {
+ Some(Ok(())) => discard(dir, uid),
+ Some(Err(e)) => log::warn!("recovery entry {uid} kept: {e}"),
+ None => {}
+ }
}
Ok(opened)
}