Browse Source

fix(groups): check for label in timer audio playing timer callback

If peer quits the group and they were just playing audio, their label will be removed but their timer will still be running. Unguarded update of label causes segfault.

Fix #5511
reviewable/pr5540/r2
Anthony Bilinski 7 years ago
parent
commit
d2508e7eac
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 6
      src/widget/form/groupchatform.cpp
  2. 1
      src/widget/widget.cpp

6
src/widget/form/groupchatform.cpp

@ -376,8 +376,10 @@ void GroupChatForm::peerAudioPlaying(ToxPk peerPk) @@ -376,8 +376,10 @@ void GroupChatForm::peerAudioPlaying(ToxPk peerPk)
if (netcam) {
static_cast<GroupNetCamView*>(netcam)->removePeer(peerPk);
}
peerLabels[peerPk]->setProperty("playingAudio", LABEL_PEER_NOT_PLAYING_AUDIO);
auto it = peerLabels.find(peerPk);
if (it != peerLabels.end()) {
peerLabels[peerPk]->setProperty("playingAudio", LABEL_PEER_NOT_PLAYING_AUDIO);
}
delete peerAudioTimers[peerPk];
peerAudioTimers[peerPk] = nullptr;
});

1
src/widget/widget.cpp

@ -1818,7 +1818,6 @@ void Widget::onGroupPeerAudioPlaying(int groupnumber, ToxPk peerPk) @@ -1818,7 +1818,6 @@ void Widget::onGroupPeerAudioPlaying(int groupnumber, ToxPk peerPk)
}
auto form = groupChatForms[g->getId()].data();
// TODO(sudden6): switch to ToxPk here
form->peerAudioPlaying(peerPk);
}

Loading…
Cancel
Save