diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index f49094ec83..0bdc59822b 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -650,7 +650,7 @@ static void *rgui_init(void) if (!rgui) goto error; - frame_buf = &menu->display.frame_buf; + frame_buf = menu_display_fb_get_ptr(); /* 4 extra lines to cache the checked background */ frame_buf->data = (uint16_t*)calloc(400 * (240 + 4), sizeof(uint16_t)); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 77a9fbefe1..3b24bf371d 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1821,7 +1821,7 @@ static void *xmb_init(void) if (!menu) goto error; - frame_buf = &menu->display.frame_buf; + frame_buf = menu_display_fb_get_ptr(); video_driver_get_size(&width, &height); diff --git a/menu/menu_display.c b/menu/menu_display.c index 52e139e6b8..28dbf52df1 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -22,6 +22,8 @@ #include "../gfx/video_context_driver.h" #include "../gfx/video_thread_wrapper.h" +static menu_framebuf_t frame_buf_state; + menu_display_t *menu_display_get_ptr(void) { menu_handle_t *menu = menu_driver_get_ptr(); @@ -32,10 +34,7 @@ menu_display_t *menu_display_get_ptr(void) menu_framebuf_t *menu_display_fb_get_ptr(void) { - menu_display_t *disp = menu_display_get_ptr(); - if (!disp) - return NULL; - return &disp->frame_buf; + return &frame_buf_state; } /** @@ -92,7 +91,8 @@ void menu_display_free(void *data) menu_animation_free(disp->animation); disp->animation = NULL; - menu_display_fb_free(&disp->frame_buf); + menu_display_fb_free(&frame_buf_state); + memset(&frame_buf_state, 0, sizeof(menu_framebuf_t)); } bool menu_display_init(void *data) diff --git a/menu/menu_display.h b/menu/menu_display.h index 6a6cd59ee7..774a93233a 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -60,7 +60,6 @@ typedef struct menu_display { bool msg_force; - menu_framebuf_t frame_buf; menu_animation_t *animation; struct