make sure uic_context_prepare_close is called before the window is destroyed (GTK)

Tue, 19 May 2026 18:25:53 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 19 May 2026 18:25:53 +0200
changeset 1130
f0def0c24ae6
parent 1129
a4affe75198c
child 1131
5e9bc6428bac

make sure uic_context_prepare_close is called before the window is destroyed (GTK)

ui/common/object.c file | annotate | diff | comparison | revisions
ui/gtk/window.c file | annotate | diff | comparison | revisions
--- a/ui/common/object.c	Tue May 19 18:10:13 2026 +0200
+++ b/ui/common/object.c	Tue May 19 18:25:53 2026 +0200
@@ -103,6 +103,7 @@
     // 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) {
+        uic_context_prepare_close(obj->ctx);
         if(obj->destroy) {
             obj->destroy(obj);
         } else {
@@ -114,7 +115,6 @@
 }
 
 void uic_object_destroy(UiObject *obj) {
-    uic_context_prepare_close(obj->ctx);
     uic_object_destroyed(obj);
     uic_context_destroy(obj->ctx, obj->ctx->document);
 }
--- a/ui/gtk/window.c	Tue May 19 18:10:13 2026 +0200
+++ b/ui/gtk/window.c	Tue May 19 18:25:53 2026 +0200
@@ -126,18 +126,6 @@
 #endif
         return TRUE;
     } else {
-        if(obj->ctx->close_callback) {
-            UiEvent ev;
-            ev.window = obj->window;
-            ev.document = obj->ctx->document;
-            ev.obj = obj;
-            ev.eventdata = NULL;
-            ev.eventdatatype = 0;
-            ev.intval = 0;
-            obj->ctx->close_callback(&ev, obj->ctx->close_data);
-            obj->ctx->close_callback = NULL;
-        }
-        
         uic_context_prepare_close(obj->ctx);
         return FALSE;
     }

mercurial