diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c index 00b96173b6..06f269ca31 100644 --- a/apps/plugins/mpegplayer/stream_mgr.c +++ b/apps/plugins/mpegplayer/stream_mgr.c @@ -1024,6 +1024,7 @@ int stream_init(void) if (grayscales < 33 || (ssize_t)memsize <= 0) { rb->splash(HZ, "graylib init failed!"); + stream_mgr.graymem = NULL; return STREAM_ERROR; } #endif /* !HAVE_LCD_COLOR */ @@ -1093,4 +1094,9 @@ void stream_exit(void) rb->thread_wait(stream_mgr.thread); stream_mgr.thread = NULL; } + +#ifndef HAVE_LCD_COLOR + if (stream_mgr.graymem != NULL) + gray_release(); +#endif } diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c index d5e927e9f1..ff0d39eba6 100644 --- a/apps/plugins/mpegplayer/video_out_rockbox.c +++ b/apps/plugins/mpegplayer/video_out_rockbox.c @@ -398,7 +398,4 @@ bool vo_is_visible(void) void vo_cleanup(void) { vo.visible = false; -#ifndef HAVE_LCD_COLOR - gray_release(); -#endif } diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c index e69089d734..aeaf942058 100644 --- a/apps/plugins/mpegplayer/video_thread.c +++ b/apps/plugins/mpegplayer/video_thread.c @@ -1030,11 +1030,4 @@ void video_thread_exit(void) IF_COP(invalidate_icache()); video_str.thread = NULL; } - else - { - /* Some things were done before thread creation */ -#ifndef HAVE_LCD_COLOR - gray_release(); -#endif - } }