mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
openal: Add cleanup guards to buffer functions
Without this, the audio might encounter an error, call cleanup() on itself, and (if in the middle of update()) try to dereference its recently cleaned-up _sd pointer. Fixes #230
This commit is contained in:
parent
6ca0a68042
commit
fd5ce687b3
@ -434,6 +434,7 @@ correct_calibrated_clock(double rtc, double t) {
|
||||
void OpenALAudioSound::
|
||||
pull_used_buffers() {
|
||||
ReMutexHolder holder(OpenALAudioManager::_lock);
|
||||
if (_manager == 0) return;
|
||||
while (_stream_queued.size()) {
|
||||
ALuint buffer = 0;
|
||||
ALint num_buffers = 0;
|
||||
@ -489,6 +490,8 @@ push_fresh_buffers() {
|
||||
ReMutexHolder holder(OpenALAudioManager::_lock);
|
||||
static unsigned char data[65536];
|
||||
|
||||
if (_manager == 0) return;
|
||||
|
||||
if (_sd->_sample) {
|
||||
while ((_loops_completed < _playing_loops) &&
|
||||
(_stream_queued.size() < 100)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user