Don't try to access driver->input_data from outside

This commit is contained in:
twinaphex 2015-11-28 18:26:05 +01:00
parent be71e654f3
commit 3b903adea1
3 changed files with 12 additions and 1 deletions

View File

@ -512,7 +512,7 @@ static bool uninit_video_input(void)
if (
!driver->input_data_own &&
(driver->input_data != video_data)
!input_driver_data_ptr_is_same(video_data)
)
input_driver_ctl(RARCH_INPUT_CTL_DEINIT, NULL);

View File

@ -621,6 +621,7 @@ retro_input_t input_keys_pressed(void)
return ret;
}
void **input_driver_get_data_ptr(void)
{
driver_t *driver = driver_get_ptr();
@ -629,6 +630,14 @@ void **input_driver_get_data_ptr(void)
return (void**)&driver->input_data;
}
bool input_driver_data_ptr_is_same(void *data)
{
driver_t *driver = driver_get_ptr();
if (!driver)
return false;
return (driver->input_data == data);
}
bool input_driver_ctl(enum rarch_input_ctl_state state, void *data)
{
driver_t *driver = driver_get_ptr();

View File

@ -259,6 +259,8 @@ bool input_driver_ctl(enum rarch_input_ctl_state state, void *data);
void **input_driver_get_data_ptr(void);
bool input_driver_data_ptr_is_same(void *data);
#ifdef __cplusplus
}
#endif