Skip to content

Commit

Permalink
fixed memory corruption while closing ui
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Aug 18, 2024
1 parent 96aa57c commit fce4780
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/ui/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void ui_cb_destroy_fragment(lv_event_t *e) {
}

SDL_Window *app_ui_create_window(app_ui_t *ui) {
Uint32 win_flags = SDL_WINDOW_RESIZABLE;
Uint32 win_flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI;
int win_x = SDL_WINDOWPOS_UNDEFINED, win_y = SDL_WINDOWPOS_UNDEFINED,
win_width = 1920, win_height = 1080;
if (app_configuration->fullscreen) {
Expand Down
17 changes: 14 additions & 3 deletions src/app/ui/ui_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ void app_ui_input_deinit(app_ui_input_t *input) {
lv_indev_delete(input->wheel.indev);
lv_indev_delete(input->button.indev);

input->key.indev = NULL;
input->pointer.indev = NULL;
input->wheel.indev = NULL;
input->button.indev = NULL;

_lv_ll_clear(&input->modal_groups);
}

Expand Down Expand Up @@ -131,7 +136,13 @@ static void app_input_populate_group(app_ui_input_t *input) {
if (!group) {
group = lv_group_get_default();
}
lv_indev_set_group(input->key.indev, group);
lv_indev_set_group(input->wheel.indev, group);
lv_indev_set_group(input->button.indev, group);
if (input->key.indev) {
lv_indev_set_group(input->key.indev, group);
}
if (input->wheel.indev) {
lv_indev_set_group(input->wheel.indev, group);
}
if (input->button.indev) {
lv_indev_set_group(input->button.indev, group);
}
}

0 comments on commit fce4780

Please sign in to comment.