From 94b4d536f120e1d7993e75fdd92d9f1c286d2830 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Thu, 4 Jun 2026 01:00:26 +0300 Subject: [PATCH] fix(styles): use allocate_handle for new style records Creating a new MLeader/Table/MLine style (and a new PlotSettings) pulled the document's next handle without advancing the counter, so two records created in one session collided on the same handle and the second overwrote the first. Use allocate_handle(), which reserves and advances. Also bumps acadrust to pick up DXF annotative-flag persistence. Co-Authored-By: Claude Opus 4.8 --- Cargo.lock | 4 ++-- src/app/update.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 017118f42..c26dd4ccd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,7 +54,7 @@ checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" [[package]] name = "acadrust" version = "0.3.4" -source = "git+https://github.com/HakanSeven12/acadrust?branch=main#c117f98c3d33dc173e3ee01f39a7729d58bc0347" +source = "git+https://github.com/HakanSeven12/acadrust?branch=main#d9b9948bad57c6a28a90153d210394f8f695c973" dependencies = [ "ahash", "anyhow", @@ -3176,7 +3176,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b577e2d69827c4740cba2b52efaad1c4cc7c73042860b199710b3575c68438d" dependencies = [ "bytecount", - "memchr 2.8.1", + "memchr 1.0.2", "nom 8.0.0", ] diff --git a/src/app/update.rs b/src/app/update.rs index 4a76cefe7..07a33bf56 100644 --- a/src/app/update.rs +++ b/src/app/update.rs @@ -5071,7 +5071,7 @@ impl OpenCADStudio { // Create a new PlotSettings object and insert it. let mut ps = PlotSettings::new(layout_name.clone()); ps.handle = - acadrust::Handle::new(self.tabs[i].scene.document.next_handle()); + self.tabs[i].scene.document.allocate_handle(); let h = ps.handle; self.tabs[i] .scene @@ -6024,7 +6024,7 @@ impl OpenCADStudio { self.push_undo_snapshot(i, "TABLESTYLE NEW"); let mut style = acadrust::objects::TableStyle::standard(); style.name = new_name.clone(); - let nh = acadrust::Handle::new(self.tabs[i].scene.document.next_handle()); + let nh = self.tabs[i].scene.document.allocate_handle(); style.handle = nh; self.tabs[i] .scene @@ -6171,7 +6171,7 @@ impl OpenCADStudio { self.push_undo_snapshot(i, "MLSTYLE NEW"); let mut style = acadrust::objects::MLineStyle::standard(); style.name = new_name.clone(); - let nh = acadrust::Handle::new(self.tabs[i].scene.document.next_handle()); + let nh = self.tabs[i].scene.document.allocate_handle(); style.handle = nh; self.tabs[i] .scene @@ -6318,7 +6318,7 @@ impl OpenCADStudio { }; self.push_undo_snapshot(i, "MLEADERSTYLE NEW"); let mut style = acadrust::objects::MultiLeaderStyle::new(&new_name); - let nh = acadrust::Handle::new(self.tabs[i].scene.document.next_handle()); + let nh = self.tabs[i].scene.document.allocate_handle(); style.handle = nh; self.tabs[i] .scene