From 20ea98d56372f3fc7015cb7cf686481362e9f440 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Tue, 30 Apr 2024 17:03:17 -0500 Subject: [PATCH] Always cache EMEMAP/SUPMAP in PU_HUDGFX tag These particular patches need to be cached in K_LoadKartHUDGraphics, but caching them anywhere else with a different tag causes them to potentially be freed and then later use-after-freed during a Sealed Star run, causing a crash. Instead, let's cache them as PU_HUDGFX in all cases where they are used. Fixes KartKrew/Kart#1240 --- src/f_finale.c | 2 +- src/k_menudraw.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index ea424e073..3ce17bbe3 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1295,7 +1295,7 @@ void F_GameEvaluationDrawer(void) patch_t *empat = W_CachePatchName( (evaluationtype == EVAL_CHAOS) ? "EMEMAP" : "SUPMAP", - PU_PATCH_LOWPRIORITY + PU_HUDGFX ); x -= 6*FRACUNIT; y -= 6*FRACUNIT; diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 812b979f6..c920f1bb6 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -3098,7 +3098,7 @@ windataemeraldmaybe: colormap ? '\0' : 'B' ); - V_DrawFixedPatch((rankx)*FRACUNIT, (ranky)*FRACUNIT, FRACUNIT, 0, W_CachePatchName(emname, PU_CACHE), colormap); + V_DrawFixedPatch((rankx)*FRACUNIT, (ranky)*FRACUNIT, FRACUNIT, 0, W_CachePatchName(emname, PU_HUDGFX), colormap); } } else if (statsmode) @@ -5414,7 +5414,7 @@ void M_DrawVideoModes(void) va("\x87" "Default mode is %dx%d", cv_scr_width.value, cv_scr_height.value)); - + if (vid.width > 1280 || vid.height > 800) V_DrawCenteredMenuString(BASEVIDWIDTH/2 + t, currentMenu->y + 75+24,