Added a single source of SDL object IDs
This ensures that we don't accidentally interpret an ID from one system as an ID in another system. Audio device IDs are not covered here, since they have a unique numbering system.
This commit is contained in:
parent
e07f6c0a17
commit
38afd48daf
23 changed files with 37 additions and 50 deletions
|
@ -58,7 +58,6 @@ static SDL_AtomicInt SDL_sensor_lock_pending;
|
|||
static int SDL_sensors_locked;
|
||||
static SDL_bool SDL_sensors_initialized;
|
||||
static SDL_Sensor *SDL_sensors SDL_GUARDED_BY(SDL_sensor_lock) = NULL;
|
||||
static SDL_AtomicInt SDL_last_sensor_instance_id;
|
||||
static char SDL_sensor_magic;
|
||||
|
||||
#define CHECK_SENSOR_MAGIC(sensor, retval) \
|
||||
|
@ -218,15 +217,6 @@ SDL_SensorID *SDL_GetSensors(int *count)
|
|||
return sensors;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the next available sensor instance ID
|
||||
* This may be called by drivers from multiple threads, unprotected by any locks
|
||||
*/
|
||||
SDL_SensorID SDL_GetNextSensorInstanceID(void)
|
||||
{
|
||||
return SDL_AtomicIncRef(&SDL_last_sensor_instance_id) + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the driver and device index for a sensor instance ID
|
||||
* This should be called while the sensor lock is held, to prevent another thread from updating the list
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue