Fix crash on conference list from std::distance.

Remove me from active speaking.
This commit is contained in:
Julien Wadel 2022-07-28 09:15:09 +02:00
parent 50d89c60fb
commit 4b8355901f
2 changed files with 5 additions and 3 deletions

View file

@ -64,9 +64,10 @@ void ConferenceInfoMapModel::add(const std::shared_ptr<linphone::ConferenceInfo>
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;

View file

@ -261,7 +261,8 @@ void ParticipantDeviceListModel::onParticipantDeviceIsSpeakingChanged(const std:
void ParticipantDeviceListModel::onParticipantDeviceSpeaking(){
auto deviceModel = qobject_cast<ParticipantDeviceModel*>(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;
}