git.lucas.co / cce-gallery
widget gallery and compositor test bench

commit9deb7120be9a2f6ae3ab966b328b63c86b8dace7
parentc5f72edec2
authorLucas Galante <[email protected]>
date2026-07-04 22:00
Fix out of bounds panic in child windows by restricting ControlPanel child mapping to parent windows

 src/main.rs | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index d140037..787b028 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -585,10 +585,12 @@ cascades in cce."
             last_ramp_mod: None,
         };
 
-        let cp_ptr = state.widgets[50].as_ptr_mut();
-        let cp = unsafe { &mut *(cp_ptr as *mut ControlPanel) };
-        for idx in [15, 16, 21, 22, 17, 19, 20, 23, 25, 26, 38, 39, 40, 41, 42, 43, 44, 47] {
-            cp.add_child(state.widgets[idx].as_ptr_mut());
+        if !is_child {
+            let cp_ptr = state.widgets[50].as_ptr_mut();
+            let cp = unsafe { &mut *(cp_ptr as *mut ControlPanel) };
+            for idx in [15, 16, 21, 22, 17, 19, 20, 23, 25, 26, 38, 39, 40, 41, 42, 43, 44, 47] {
+                cp.add_child(state.widgets[idx].as_ptr_mut());
+            }
         }
 
         cce_ui::scale::set_scale_factor(scale as f32);