mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
00f5f4fc90
System_AudioPushSamples() runs on the emu thread when one is active (GL/GLCore backends) and appends to / reallocs output_audio_buffer, while retro_run() on the libretro thread reads .data/.size and resets .size in upload_output_audio_buffer(), unsynchronized. A realloc on the emu thread can free the pointer while audio_batch_cb() reads it. Guard the four access sites with a mutex (<mutex> was already included in this file, unused). The lock is held across audio_batch_cb() — no second buffer; worst case the emu thread briefly backpressures while the frontend syncs audio. Behavior is otherwise unchanged.