mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-09 03:29:43 -10:00
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:
1 parent
6fec2474c5
commit
d6ee7ca3ba
1 file changed
+9
-3
+9
-3
@@ -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 */
|
||||
|
||||
Reference in new issue
Block a user