Browse Source

unsubscribe invalid ToxCall from audio when copied

pull/2509/head
Nils Fenner 10 years ago
parent
commit
27bfade9e1
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C
  1. 18
      src/core/toxcall.cpp

18
src/core/toxcall.cpp

@ -46,6 +46,12 @@ ToxCall::ToxCall(ToxCall&& other) noexcept @@ -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 @@ -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;

Loading…
Cancel
Save