widget gallery and compositor test bench
fix: call set_focused_ptr inside the unsafe block it needs
cce-ui made UiContext::set_focused_ptr an unsafe fn (its pointer must be
live at the call); the preset dropdown's pointer is taken just above, so
the call moves into the unsafe block that already dereferences it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/main.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main.rs b/src/main.rs
index 3b81f2d..6e7f205 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1296,8 +1296,9 @@ impl cce_ui::engine::Application for State {
// Window on the Windows page spawned children that died at startup.
let preset_ptr = ramp.preset_dropdown.as_ptr_mut();
state.focused_widget = Some(1);
- state.ui_context.set_focused_ptr(preset_ptr);
+ // SAFETY: `preset_ptr` was just taken from the live dropdown above.
unsafe {
+ state.ui_context.set_focused_ptr(preset_ptr);
(*preset_ptr).focus();
}
}