ui/winui/window.cpp

branch
newapi
changeset 247
4b21af9d8c5a
parent 244
33c0a3797a0d
child 250
d2068517fbdd
--- a/ui/winui/window.cpp	Wed Feb 07 17:15:03 2024 +0100
+++ b/ui/winui/window.cpp	Thu Feb 08 10:17:59 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