git.lucas.co / cce-authenticator
login authentication (PAM + fingerprint)
git clone https://git.lucas.co/cce-authenticator.git

commit14357abf0dfd22bab25864e08e32a0f319acdded
parent470150f2ac
authorLucas Galante <lsgalante12@gmail.com>
date2026-10-07 15:29
refactor: register widgets by reference (UiContext::register_host)

register_widget(id, ptr) took a raw pointer in a safe function; cce-ui is
making it an unsafe fn now that every app registers through
register_host(&mut w), which takes the widget's own id and a live borrow.
Registration loops that existed only to hand the registry raw pointers
(and the unsafe blocks and self_ptr casts around them) are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

diff --git a/src/main.rs b/src/main.rs
index 9e38f9c..1c33533 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -658,14 +658,10 @@ impl Application for AuthenticatorApp {
         // four roots' registrations fresh each frame (idempotent; the dialog assembles
         // its frame by hand, so nothing else registers them).
         {
-            let (id, ptr) = (self.verify_btn.id(), self.verify_btn.as_ptr_mut());
-            self.ui_context.register_widget(id, ptr);
-            let (id, ptr) = (self.cancel_btn.id(), self.cancel_btn.as_ptr_mut());
-            self.ui_context.register_widget(id, ptr);
-            let (id, ptr) = (self.fingerprint_btn.id(), self.fingerprint_btn.as_ptr_mut());
-            self.ui_context.register_widget(id, ptr);
-            let (id, ptr) = (self.password_box.id(), self.password_box.as_ptr_mut());
-            self.ui_context.register_widget(id, ptr);
+            self.ui_context.register_host(&mut self.verify_btn);
+            self.ui_context.register_host(&mut self.cancel_btn);
+            self.ui_context.register_host(&mut self.fingerprint_btn);
+            self.ui_context.register_host(&mut self.password_box);
         }
         // Phase 6ag single paint path: the whole frame — card, columns, widgets, and all
         // text — is this one list. NOTE this migration is a FIX, not a match: the app's old