fix(blocks): prevent circular block nesting and cut render cycles

Introduce would_create_cycle in block_service to prevent recursive block definitions with case-insensitive matching across block records. Enforce cycle refusal at INSERT commit in BEDIT and during block redefinition (redefine_block_raw) with a shared error message. Ensure render-time recursion truncates safely with a one-time session warning on cyclic documents.
This commit is contained in:
Karim Jerbi committed 2026-10-13 11:10:11 +01:00
1 parent 59bb6faabd
commit 9c08e8a3ed
8 files changed
+435 -24

No files matched your search

+5 -2
View File
@@ -580,11 +580,14 @@ impl OpenCADStudio {
.define_block_raw(&def.name, def.base_point, def.entities);
}
if redefine {
self.tabs[i].scene.redefine_block_raw(
if let Err(err) = self.tabs[i].scene.redefine_block_raw(
&name,
codec::types::Vector3::new(base.x, base.y, base.z),
entities,
);
) {
self.command_line.push_error(&err);
return Err(err);
}
} else {
self.tabs[i]
.scene