diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 7e52513e76..c1fe7845d5 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -233,6 +233,16 @@ void video_driver_make_current_context(void) driver.video_poke->make_current_context(driver.video_data); } +bool video_driver_is_alive(void) +{ + /* Possible race issue, return true */ + if (!driver.video || !driver.video_data) + return true; + if (!driver.video->alive(driver.video_data)) + return false; + return true; +} + static void deinit_video_filter(void) { rarch_softfilter_free(g_extern.filter.filter); diff --git a/gfx/video_driver.h b/gfx/video_driver.h index d4cd285588..acafb73024 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -244,6 +244,8 @@ retro_proc_address_t video_driver_get_proc_address(const char *sym); void video_driver_make_current_context(void); +bool video_driver_is_alive(void); + void uninit_video_input(void); void init_video(void); diff --git a/runloop.c b/runloop.c index 45fcc038a9..5247e4d262 100644 --- a/runloop.c +++ b/runloop.c @@ -636,7 +636,7 @@ static inline int time_to_exit(retro_input_t input) || (g_extern.max_frames && g_extern.frame_count >= g_extern.max_frames) || (g_extern.bsv.movie_end && g_extern.bsv.eof_exit) - || !driver.video->alive(driver.video_data) + || !video_driver_is_alive() ) return 1; return 0;