ui/common/object.c

branch
newapi
changeset 406
0ebf9d7b23e8
parent 404
384f6d1f5784
--- a/ui/common/object.c	Wed Dec 04 08:57:35 2024 +0100
+++ b/ui/common/object.c	Wed Dec 04 18:31:22 2024 +0100
@@ -64,16 +64,17 @@
     obj->ref++;
 }
 
-void ui_object_unref(UiObject *obj) {
+int ui_object_unref(UiObject *obj) {
     // it is possible to have 0 references, in case
     // a window was created but ui_show was never called
     if(obj->ref == 0 || --obj->ref == 0) {
         if(obj->destroy) {
             obj->destroy(obj);
-        } else {
-            uic_object_destroy(obj);
         }
+        uic_object_destroy(obj);
+        return 0;
     }
+    return 1;
 }
 
 void uic_object_destroy(UiObject *obj) {

mercurial