ui/winui/window.cpp

changeset 21
3060a5a1d5fd
parent 18
af411868ab9b
child 27
c254ed644edf
--- a/ui/winui/window.cpp	Wed Feb 07 17:10:01 2024 +0100
+++ b/ui/winui/window.cpp	Thu Feb 08 10:22:58 2024 +0100
@@ -171,7 +171,17 @@
 	ui_context_add_window_destructor(obj->ctx, obj->wobj);
 
 	window.Closed([obj](IInspectable const& sender, WindowEventArgs) {
-		cxMempoolDestroy(obj->ctx->mp);
+		if (obj->ctx->close_callback) {
+			UiEvent evt;
+			evt.obj = obj;
+			evt.document = obj->ctx->document;
+			evt.window = obj->window;
+			evt.eventdata = NULL;
+			evt.intval = 0;
+			obj->ctx->close_callback(&evt, obj->ctx->close_data);
+		} else {
+			ui_context_destroy(obj->ctx);
+		}
 		});
 
 	obj->container = new UiBoxContainer(grid, UI_BOX_CONTAINER_VBOX, 0, 0);

mercurial