Don't touch driver->frontend outside of frontend_driver.c anymore

This commit is contained in:
twinaphex 2015-12-05 08:52:01 +01:00
parent f16fc89b1b
commit c36b8e1ae9
3 changed files with 21 additions and 3 deletions

View File

@ -176,4 +176,20 @@ environment_get_t frontend_driver_environment_get_ptr(void)
return NULL;
return driver->frontend_ctx->environment_get;
}
bool frontend_driver_has_get_video_driver_func(void)
{
driver_t *driver = driver_get_ptr();
if (!driver || !driver->frontend_ctx || !driver->frontend_ctx->get_video_driver)
return false;
return true;
}
const struct video_driver *frontend_driver_get_video_driver(void)
{
driver_t *driver = driver_get_ptr();
if (!driver || !driver->frontend_ctx || !driver->frontend_ctx->get_video_driver)
return NULL;
return driver->frontend_ctx->get_video_driver();
}
#endif

View File

@ -124,6 +124,9 @@ void frontend_driver_init_first(void *args);
environment_get_t frontend_driver_environment_get_ptr(void);
bool frontend_driver_has_get_video_driver_func(void);
const struct video_driver *frontend_driver_get_video_driver(void);
#ifdef __cplusplus
}
#endif

View File

@ -241,10 +241,9 @@ static bool find_video_driver(void)
}
#endif
if (driver->frontend_ctx &&
driver->frontend_ctx->get_video_driver)
if (frontend_driver_has_get_video_driver_func())
{
current_video = driver->frontend_ctx->get_video_driver();
current_video = frontend_driver_get_video_driver();
if (current_video)
return true;