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

fix(group): use valid pointer, allowing source invalidation

Fix #5681
This commit is contained in:
Anthony Bilinski 2019-07-31 14:17:27 -07:00
parent b2e7a7fa31
commit 765fce94b7
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C

View File

@ -295,12 +295,11 @@ void ToxGroupCall::removePeer(ToxPk peerId)
void ToxGroupCall::addPeer(ToxPk peerId)
{
std::unique_ptr<IAudioSink> newSink = audio.makeSink();
peers.emplace(peerId, std::move(newSink));
QMetaObject::Connection con =
QObject::connect(newSink.get(), &IAudioSink::invalidated,
[this, peerId]() { this->onAudioSinkInvalidated(peerId); });
peers.emplace(peerId, std::move(newSink));
sinkInvalid.insert({peerId, con});
}