nyx: fix a mem leak on closing emummc change win

This commit is contained in:
CTCaer
2025-11-10 13:50:07 +02:00
parent 50d56c7b4b
commit 5d75b01491

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2024 CTCaer
* Copyright (c) 2019-2025 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -900,9 +900,9 @@ static emummc_images_t *emummc_img;
static lv_res_t _save_emummc_cfg_mbox_action(lv_obj_t *btns, const char *txt)
{
// Free components, delete main emuMMC and popup windows and relaunch main emuMMC window.
free(emummc_img->dirlist);
lv_obj_del(emummc_img->win);
lv_obj_del(emummc_manage_window);
free(emummc_img->dirlist);
free(emummc_img);
mbox_action(btns, txt);
@@ -973,9 +973,17 @@ static lv_res_t _save_file_emummc_cfg_action(lv_obj_t *btn)
return LV_RES_INV;
}
static lv_res_t _action_win_change_emummc_close(lv_obj_t *btn)
{
free(emummc_img->dirlist);
free(emummc_img);
return nyx_win_close_action_custom(btn);
}
static lv_res_t _create_change_emummc_window(lv_obj_t *btn_caller)
{
lv_obj_t *win = nyx_create_standard_window(SYMBOL_SETTINGS" Change emuMMC");
lv_obj_t *win = nyx_create_window_custom_close_btn(SYMBOL_SETTINGS" Change emuMMC", _action_win_change_emummc_close);
lv_win_add_btn(win, NULL, SYMBOL_POWER" Disable", _save_disable_emummc_cfg_action);
sd_mount();