fix UiObject close handling default tip

Mon, 18 May 2026 21:29:56 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 18 May 2026 21:29:56 +0200
changeset 1128
0a150985d6b6
parent 1127
d3a8c29ebdaa

fix UiObject close handling

ui/common/object.c file | annotate | diff | comparison | revisions
ui/gtk/toolkit.c file | annotate | diff | comparison | revisions
--- a/ui/common/object.c	Sun May 17 10:46:35 2026 +0200
+++ b/ui/common/object.c	Mon May 18 21:29:56 2026 +0200
@@ -105,8 +105,9 @@
     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;
--- a/ui/gtk/toolkit.c	Sun May 17 10:46:35 2026 +0200
+++ b/ui/gtk/toolkit.c	Mon May 18 21:29:56 2026 +0200
@@ -181,7 +181,8 @@
 }
 
 void ui_close(UiObject *obj) {
-    uic_context_prepare_close(obj->ctx); // TODO: should this be moved to the close event handler?
+    uic_context_prepare_close(obj->ctx); // TODO: should this be moved to the close event handler? Yes!
+    /*
     if(obj->widget) {
 #if GTK_CHECK_VERSION(4, 0, 0)
         gtk_window_close(GTK_WINDOW(obj->widget));
@@ -191,6 +192,8 @@
     } else {
         ui_window_close_request(obj);
     }
+    */
+    ui_window_close_request(obj);
 }
 
 

mercurial