bug: fix crashing race condition in mod_dub

This commit is contained in:
Dave Horton
2024-03-25 18:14:44 -04:00
parent be6758c3a8
commit 48aeedec0a
2 changed files with 24 additions and 18 deletions
+12 -9
View File
@@ -636,15 +636,18 @@ void AudioProducerHttp::stop() {
}
void AudioProducerHttp::reset() {
if (_easy) {
curl_multi_remove_handle(global.multi, _easy);
curl_easy_cleanup(_easy);
_easy = nullptr;
}
if (_mh) {
mpg123_close(_mh);
mpg123_delete(_mh);
_mh = nullptr;
{
std::lock_guard<std::mutex> lock(_mutex);
if (_easy) {
curl_multi_remove_handle(global.multi, _easy);
curl_easy_cleanup(_easy);
_easy = nullptr;
}
if (_mh) {
mpg123_close(_mh);
mpg123_delete(_mh);
_mh = nullptr;
}
}
_err_msg.clear();
_response_code = 0;