summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-28 18:51:57 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-28 18:51:57 -0400
commita5a8e00b6d0939527eb764745eef6f86d187cc6a (patch)
treef266f16ac7e9961359e5fd75b7b7b55f23baedf4
parent8c8284bbe642318a8c661a834456841307431a7b (diff)
downloadrockbox-a5a8e00b6d0939527eb764745eef6f86d187cc6a.tar.gz
rockbox-a5a8e00b6d0939527eb764745eef6f86d187cc6a.tar.bz2
rockbox-a5a8e00b6d0939527eb764745eef6f86d187cc6a.zip
Fix a crash introduced in a605cdf70
Pretty subtle problem; looks like the skin core was relying on a destructor to actually help initialize things. Change-Id: Ieb4b9e4f11377dec7be61d13759590fc5f4bc921
-rw-r--r--apps/gui/skin_engine/skin_parser.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 8e59c2c2b0..789d42aab5 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -1715,7 +1715,7 @@ void skin_data_free_buflib_allocs(struct wps_data *wps_data)
if (wps_data->wps_loaded)
skin_buffer = get_skin_buffer(wps_data);
if (!skin_buffer)
- return;
+ goto abort;
#ifndef __PCTOOL__
struct skin_token_list *list = SKINOFFSETTOPTR(skin_buffer, wps_data->images);
@@ -1744,13 +1744,15 @@ void skin_data_free_buflib_allocs(struct wps_data *wps_data)
}
list = SKINOFFSETTOPTR(skin_buffer, list->next);
}
- wps_data->images = PTRTOSKINOFFSET(skin_buffer, NULL);
if (font_ids != NULL)
{
while (wps_data->font_count > 0)
font_unload(font_ids[--wps_data->font_count]);
}
- wps_data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL);
+
+abort:
+ wps_data->font_ids = PTRTOSKINOFFSET(skin_buffer, NULL); /* Safe if skin_buffer is NULL */
+ wps_data->images = PTRTOSKINOFFSET(skin_buffer, NULL);
if (wps_data->buflib_handle > 0)
core_free(wps_data->buflib_handle);
wps_data->buflib_handle = -1;