1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Destroy AL context before closing old device

I refuse to compile this code, so it's not tested.
This should fix the segfault in alcDestroyContext.
This commit is contained in:
A. L'mao 2014-11-30 11:04:55 -08:00
parent 90e8afa24d
commit 545cde519c

View File

@ -87,8 +87,6 @@ void Audio::openOutput(const QString& outDevDescr)
{
auto* tmp = alOutDev;
alOutDev = nullptr;
if (tmp)
alcCloseDevice(tmp);
if (outDevDescr.isEmpty())
alOutDev = alcOpenDevice(nullptr);
else
@ -104,6 +102,8 @@ void Audio::openOutput(const QString& outDevDescr)
alcMakeContextCurrent(nullptr);
alcDestroyContext(alContext);
}
if (tmp)
alcCloseDevice(tmp);
alContext=alcCreateContext(alOutDev,nullptr);
if (!alcMakeContextCurrent(alContext))
{