xmb: don't dereference a torn-down display context in the frame pass

The display context is NULL around a video driver reinit while
cached frames can still be submitted; every draw in xmb_frame() and
xmb_draw_icon() already checks dispctx before use except the
handles_transform probe, which dereferenced p_disp->dispctx
directly.  xmb_draw_icon() now bails without a context, xmb_frame()
skips the rotate, and mymat is zero-initialised so a skipped rotate
cannot copy indeterminate values into per-icon matrices.
This commit is contained in:
libretroadmin committed 2026-08-20 01:33:39 +02:00
1 parent 6fec2474c5
commit d6ee7ca3ba
1 file changed
+9 -3
+9 -3
View File
@@ -1115,7 +1115,13 @@ static void xmb_draw_icon(
)
return;
if (!p_disp->dispctx->handles_transform)
/* Every draw below goes through dispctx; without one there is
* nothing to render (the context is torn down around a video
* driver reinit while cached frames may still be submitted). */
if (!dispctx)
return;
if (!dispctx->handles_transform)
{
float radians = rotation;
float cosine = cosf(radians);
@@ -9159,7 +9165,7 @@ error:
static void xmb_frame(void *data, video_frame_info_t *video_info)
{
math_matrix_4x4 mymat;
math_matrix_4x4 mymat = {{ 0.0f }};
unsigned i;
char title_msg[128];
char msg[1024];
@@ -9381,7 +9387,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
selection = menu_st->selection_ptr;
if (!p_disp->dispctx->handles_transform)
if (dispctx && !dispctx->handles_transform)
{
float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */
float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */