From 4b8355901f4fcf9813a6a34635e9671149d3bfea Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Thu, 28 Jul 2022 09:15:09 +0200 Subject: [PATCH] Fix crash on conference list from std::distance. Remove me from active speaking. --- .../src/components/conferenceInfo/ConferenceInfoMapModel.cpp | 5 +++-- .../components/participant/ParticipantDeviceListModel.cpp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.cpp b/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.cpp index 0c5f9c5b3..c959c2fc0 100644 --- a/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.cpp +++ b/linphone-app/src/components/conferenceInfo/ConferenceInfoMapModel.cpp @@ -64,9 +64,10 @@ void ConferenceInfoMapModel::add(const std::shared_ptr if(sendEvents){ int row = 0; auto it = mMappedList.begin(); - while(it != mMappedList.end() && it.key() < conferenceDateTimeSystem) + while(it != mMappedList.end() && it.key() < conferenceDateTimeSystem){ + ++row; ++it; - row = std::distance(it,mMappedList.begin()); + } beginInsertColumns(QModelIndex(), row, row); } mMappedList[conferenceDateTimeSystem] = proxy; diff --git a/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp b/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp index 51ff3b844..ab77ed47c 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp +++ b/linphone-app/src/components/participant/ParticipantDeviceListModel.cpp @@ -261,7 +261,8 @@ void ParticipantDeviceListModel::onParticipantDeviceIsSpeakingChanged(const std: void ParticipantDeviceListModel::onParticipantDeviceSpeaking(){ auto deviceModel = qobject_cast(sender()); bool changed = (mActiveSpeakers.removeAll(deviceModel) > 0); - if( mActiveSpeakers.size() == 0 || deviceModel->getIsSpeaking()) {// Ensure to have at least one last active speaker + // Me should not be in the list. + if( !deviceModel->isMe() && (mActiveSpeakers.size() == 0 || deviceModel->getIsSpeaking())) {// Ensure to have at least one last active speaker mActiveSpeakers.push_front(deviceModel); changed = true; }