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 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-04 01:00:26 +03:00
1 parent 10d674f606
commit 94b4d536f1
2 files changed
+6 -6

No files matched your search

Generated
+2 -2
View File
@@ -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",
]
+4 -4
View File
@@ -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