diff --git a/retroshare-gui/src/gui/common/FriendListModel.cpp b/retroshare-gui/src/gui/common/FriendListModel.cpp index 408527b3e..abd1c7450 100644 --- a/retroshare-gui/src/gui/common/FriendListModel.cpp +++ b/retroshare-gui/src/gui/common/FriendListModel.cpp @@ -1058,14 +1058,16 @@ void RsFriendListModel::updateInternalData() preMods(); beginRemoveRows(QModelIndex(),0,mTopLevel.size()-1); - endRemoveRows(); mGroups.clear(); mProfiles.clear(); mLocations.clear(); - mTopLevel.clear(); + endRemoveRows(); + + auto TL = mTopLevel ; // This allows to fill TL without touching mTopLevel outside of [begin/end]InsertRows(). + // create a map of profiles and groups std::map pgp_indices; @@ -1153,7 +1155,6 @@ void RsFriendListModel::updateInternalData() RsDbg() << "Creating top level list" << std::endl; #endif - mTopLevel.clear(); std::set already_in_a_group; if(mDisplayGroups) // in this case, we list all groups at the top level followed by the profiles without parent group @@ -1168,7 +1169,7 @@ void RsFriendListModel::updateInternalData() e.type = ENTRY_TYPE_GROUP; e.group_index = i; - mTopLevel.push_back(e); + TL.push_back(e); for(uint32_t j=0;j