diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 2beabbcd1..676f400fb 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -313,8 +313,10 @@ void GxsForumThreadWidget::changeEvent(QEvent *e) } } -static void removeMessages(std::map > &msgIds, const QList &removeMsgId) +static void removeMessages(std::map > &msgIds, QList &removeMsgId) { + QList removedMsgId; + std::map >::iterator grpIt; for (grpIt = msgIds.begin(); grpIt != msgIds.end(); ) { std::vector &msgs = grpIt->second; @@ -323,6 +325,7 @@ static void removeMessages(std::map > for (removeMsgIt = removeMsgId.begin(); removeMsgIt != removeMsgId.end(); ++removeMsgIt) { std::vector::iterator msgIt = std::find(msgs.begin(), msgs.end(), *removeMsgIt); if (msgIt != msgs.end()) { + removedMsgId.push_back(*removeMsgIt); msgs.erase(msgIt); } } @@ -334,6 +337,14 @@ static void removeMessages(std::map > ++grpIt; } } + + if (!removedMsgId.isEmpty()) { + QList::const_iterator removedMsgIt; + for (removedMsgIt = removedMsgId.begin(); removedMsgIt != removedMsgId.end(); ++removedMsgIt) { + // remove first message id + removeMsgId.removeOne(*removedMsgIt); + } + } } void GxsForumThreadWidget::updateDisplay(bool complete) @@ -367,7 +378,6 @@ void GxsForumThreadWidget::updateDisplay(bool complete) if (!mIgnoredMsgId.empty()) { /* Filter ignored messages */ removeMessages(msgIds, mIgnoredMsgId); - mIgnoredMsgId.clear(); } if (msgIds.find(groupId()) != msgIds.end()) {