fix(image): new image definitions allocate their own handle so DWG keeps them

The definition took a peeked handle that the image then also received;
the DWG writer dropped the shared-handle definition and reopened images
lost their file.

Fixes #1421

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-09-28 18:24:38 +03:00
1 parent 1db1ea0140
commit b365e51620
1 file changed
+3 -1
+3 -1
View File
@@ -1058,7 +1058,9 @@ impl Scene {
return;
}
use codec::objects::{ImageDefinition, ObjectType};
let def_handle = Handle::new(self.document.next_handle());
// Allocate, not peek: a peeked handle is then handed to the image
// itself, and the DWG writer drops the definition that shares it. (#1421)
let def_handle = self.document.allocate_handle();
if self.is_recording_undo() {
self.record_undo_object_before(def_handle, None);
}