Skip to content

Commit

Permalink
fix: destroy all windows before destroying other resources
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Aug 26, 2024
1 parent c0c1189 commit bc507a4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/lcui_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,21 +450,20 @@ void lcui_init_ui(void)

void lcui_destroy_ui(void)
{
lcui_ui.image_loader.active = false;
lcui_ui.quit_after_all_windows_closed = true;
lcui_ui_image_loader_refresh();
thread_join(lcui_ui.image_loader.thread, NULL);
thread_mutex_destroy(&lcui_ui.image_loader.mutex);
thread_cond_destroy(&lcui_ui.image_loader.cond);

lcui_destroy_ui_preset_widgets();
app_off_event(APP_EVENT_CLOSE, lcui_on_window_destroy);
list_destroy(&lcui_ui.windows, lcui_close_window);
if (lcui_ui.observer) {
ui_mutation_observer_disconnect(lcui_ui.observer);
ui_mutation_observer_destroy(lcui_ui.observer);
lcui_ui.observer = NULL;
}
lcui_ui.image_loader.active = false;
lcui_ui.quit_after_all_windows_closed = true;
lcui_ui_image_loader_refresh();
thread_join(lcui_ui.image_loader.thread, NULL);
thread_mutex_destroy(&lcui_ui.image_loader.mutex);
thread_cond_destroy(&lcui_ui.image_loader.cond);
lcui_destroy_ui_preset_widgets();
ui_server_destroy();
ui_destroy();
}

0 comments on commit bc507a4

Please sign in to comment.