fix crash when closing platform popups
This commit is contained in:
@@ -1919,12 +1919,16 @@ static void do_frame(AppState *app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui_widgets_begin_frame(input);
|
ui_widgets_begin_frame(input);
|
||||||
if (app->master_layout == 0) ui_piano_update_input(&app->piano_state);
|
|
||||||
update_panel_splitters(app);
|
|
||||||
|
|
||||||
// Build UI with Clay
|
// Build UI with Clay
|
||||||
ui_begin_frame(app->ui, (F32)w, (F32)h, input.mouse_pos, input.mouse_down,
|
ui_begin_frame(app->ui, (F32)w, (F32)h, input.mouse_pos, input.mouse_down,
|
||||||
input.scroll_delta, dt);
|
input.scroll_delta, dt);
|
||||||
|
|
||||||
|
// These query previous frame's Clay layout data (Clay_GetElementData,
|
||||||
|
// Clay_PointerOver) so they must run after ui_begin_frame sets the context.
|
||||||
|
if (app->master_layout == 0) ui_piano_update_input(&app->piano_state);
|
||||||
|
update_panel_splitters(app);
|
||||||
|
|
||||||
build_ui(app);
|
build_ui(app);
|
||||||
Clay_RenderCommandArray render_commands = ui_end_frame(app->ui);
|
Clay_RenderCommandArray render_commands = ui_end_frame(app->ui);
|
||||||
|
|
||||||
@@ -2078,6 +2082,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
popup_close_all();
|
popup_close_all();
|
||||||
|
platform_set_frame_callback(window, nullptr, nullptr);
|
||||||
audio_destroy(audio);
|
audio_destroy(audio);
|
||||||
midi_destroy(midi);
|
midi_destroy(midi);
|
||||||
ui_destroy(ui);
|
ui_destroy(ui);
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ static LRESULT CALLBACK win32_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
|
|||||||
pw->should_close = true;
|
pw->should_close = true;
|
||||||
return 0;
|
return 0;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
PostQuitMessage(0);
|
if (pw == g_main_window)
|
||||||
|
PostQuitMessage(0);
|
||||||
return 0;
|
return 0;
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
if ((wparam & 0xfff0) == SC_KEYMENU)
|
if ((wparam & 0xfff0) == SC_KEYMENU)
|
||||||
|
|||||||
@@ -80,11 +80,12 @@ void popup_close(PopupWindow *popup) {
|
|||||||
if (popup->open_flag)
|
if (popup->open_flag)
|
||||||
*popup->open_flag = 0;
|
*popup->open_flag = 0;
|
||||||
|
|
||||||
|
popup->alive = 0;
|
||||||
|
platform_set_frame_callback(popup->platform_window, nullptr, nullptr);
|
||||||
|
|
||||||
ui_destroy(popup->ui_ctx);
|
ui_destroy(popup->ui_ctx);
|
||||||
renderer_destroy(popup->renderer);
|
renderer_destroy(popup->renderer);
|
||||||
platform_destroy_window(popup->platform_window);
|
platform_destroy_window(popup->platform_window);
|
||||||
|
|
||||||
popup->alive = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void popup_do_frame(PopupWindow *popup, F32 dt) {
|
void popup_do_frame(PopupWindow *popup, F32 dt) {
|
||||||
|
|||||||
Reference in New Issue
Block a user