]> uap-core.de Git - note.git/commitdiff
use UiObject::from_ptr in window_create instead of creating the UiObject manually
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Wed, 20 May 2026 16:41:11 +0000 (18:41 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Wed, 20 May 2026 16:41:11 +0000 (18:41 +0200)
ui-rs/src/ui/window.rs

index c98cf3a158dbd85e0747cfb0c03eab3ba7754e6c..a2cabfdfb3b0fdbfe0c11ae13df8495808d6bbca 100644 (file)
@@ -100,22 +100,9 @@ where F: FnOnce(&mut toolkit::UiObject<T>, &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::<T> {
-        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);