From 58699ed168a8abec34b38707b179f9f95dda9367 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Wed, 20 May 2026 18:41:11 +0200 Subject: [PATCH] use UiObject::from_ptr in window_create instead of creating the UiObject manually --- ui-rs/src/ui/window.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) 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); -- 2.47.3