From: Olaf Wintermann Date: Wed, 20 May 2026 16:41:11 +0000 (+0200) Subject: use UiObject::from_ptr in window_create instead of creating the UiObject manually X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=HEAD;p=note.git use UiObject::from_ptr in window_create instead of creating the UiObject manually --- diff --git a/ui-rs/src/ui/window.rs b/ui-rs/src/ui/window.rs index c98cf3a..a2cabfd 100644 --- a/ui-rs/src/ui/window.rs +++ b/ui-rs/src/ui/window.rs @@ -100,22 +100,9 @@ where F: FnOnce(&mut toolkit::UiObject, &mut T) { WindowType::DialogWindow => ui_dialog_window_create(parent, args) } }; - // because we use additional reference counting in the Rust UiObject wrapper, - // we always increase the reference counter here - unsafe { - ui_object_ref(objptr); - } - - let ctxptr = unsafe { - ui_object_get_context(objptr) - }; // create local UiObject - let mut obj = toolkit::UiObject:: { - ptr: objptr, - ctx: toolkit::UiContext::from_ptr(ctxptr), - _data: PhantomData - }; + let mut obj = toolkit::UiObject::from_ptr(objptr); // store windowdata object in the UiObject let window_data = Box::new(data);