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

unsubscribe invalid ToxCall from audio when copied

This commit is contained in:
Nils Fenner 2015-12-05 15:11:06 +01:00
parent d8607324ce
commit 27bfade9e1
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C

View File

@ -46,6 +46,12 @@ ToxCall::ToxCall(ToxCall&& other) noexcept
other.callId = numeric_limits<decltype(callId)>::max();
other.alSource = 0;
Audio& audio = Audio::getInstance();
audio.subscribeInput(this);
audio.unsubscribeInput(&other);
audio.subscribeOutput(this);
audio.unsubscribeOutput(&other);
#ifdef QTOX_FILTER_AUDIO
filterer = other.filterer;
other.filterer = nullptr;
@ -54,18 +60,20 @@ ToxCall::ToxCall(ToxCall&& other) noexcept
ToxCall::~ToxCall()
{
if (alSource)
Audio::getInstance().deleteSource(alSource);
Audio& audio = Audio::getInstance();
if (sendAudioTimer)
{
QObject::disconnect(sendAudioTimer, nullptr, nullptr, nullptr);
sendAudioTimer->stop();
Audio& audio = Audio::getInstance();
audio.unsubscribeInput(this);
audio.unsubscribeOutput(this);
}
if (alSource)
audio.deleteSource(alSource);
audio.unsubscribeInput(this);
audio.unsubscribeOutput(this);
#ifdef QTOX_FILTER_AUDIO
if (filterer)
delete filterer;