--- a/ui/winui/button.cpp Mon Oct 02 10:10:09 2023 +0200 +++ b/ui/winui/button.cpp Mon Oct 02 19:31:06 2023 +0200 @@ -68,19 +68,16 @@ // register callback if (args.onclick) { - widget->obj = obj; - widget->event_func = (ui_eventfunc)args.onclick; - widget->event_data = args.onclickdata; - button.Click([widget](IInspectable const& sender, RoutedEventArgs) { - ui_callback cb = (ui_callback)widget->event_func; - + ui_callback cbfunc = args.onclick; + void* cbdata = args.onclickdata; + button.Click([cbfunc, cbdata, obj](IInspectable const& sender, RoutedEventArgs) { UiEvent evt; - evt.obj = (UiObject*)widget->obj; - evt.window = evt.obj->window; - evt.document = evt.obj->ctx->document; + evt.obj = obj; + evt.window = obj->window; + evt.document = obj->ctx->document; evt.eventdata = nullptr; evt.intval = 0; - cb(&evt, widget->event_data); + cbfunc(&evt, cbdata); }); }