git.lucas.co / cce-designer
graphic design tool
git clone https://git.lucas.co/cce-designer.git

commita532a185223c86c350ba0611425bf38bb76dd7a5
parentce153370cf
authorLucas Galante <[email protected]>
date2026-06-22 14:52
fix: Box root_window to ensure stable pointer for children's parent links

 src/app.rs    | 10 ++++++----
 src/render.rs |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/app.rs b/src/app.rs
index 646f992..a8e39df 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -713,7 +713,7 @@ pub struct State {
     pub origin_size: f32,
     pub camera_pivot_size: f32,
 
-    pub root_window: cce_ui::widget::Window,
+    pub root_window: Box<cce_ui::widget::Window>,
     pub fs_root: FsNode,
     pub node_templates: Vec<NodeTemplate>,
     pub current_path: Vec<usize>,
@@ -2753,9 +2753,11 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
             shortcut_manager,
             pending_action: None,
             exit_requested: false,
-            root_window: cce_ui::widget::Window::new(0.0, 0.0, lw, lh)
-                .with_background([0.0, 0.0, 0.0, 0.0])
-                .with_border([0.0, 0.0, 0.0, 0.0], 0.0),
+            root_window: Box::new(
+                cce_ui::widget::Window::new(0.0, 0.0, lw, lh)
+                    .with_background([0.0, 0.0, 0.0, 0.0])
+                    .with_border([0.0, 0.0, 0.0, 0.0], 0.0)
+            ),
             widgets,
             positions,
             splitter_layout,
diff --git a/src/render.rs b/src/render.rs
index 9376c1e..5163b3a 100644
--- a/src/render.rs
+++ b/src/render.rs
@@ -110,7 +110,7 @@ impl State {
 
         let mut visited = vec![false; self.widgets.len()];
         self.draw_element_recursive(
-            &self.root_window,
+            self.root_window.as_ref(),
             verts,
             sw,
             sh,