Browse Source

audio: Fixed adding new physical devices to a double-linked list.

(Forgot to hook up existing node's `prev` field when adding the new device
to the head of the list. Doh.)
Ryan C. Gordon 2 years ago
parent
commit
cdd2ba81de
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/audio/SDL_audio.c

+ 5 - 0
src/audio/SDL_audio.c

@@ -246,6 +246,11 @@ static SDL_AudioDevice *CreatePhysicalAudioDevice(const char *name, SDL_bool isc
     device->instance_id = assign_audio_device_instance_id(iscapture, /*islogical=*/SDL_FALSE);
 
     SDL_LockRWLockForWriting(current_audio.device_list_lock);
+
+    if (*devices) {
+        SDL_assert((*devices)->prev == NULL);
+        (*devices)->prev = device;
+    }
     device->next = *devices;
     *devices = device;
     SDL_AtomicIncRef(device_count);