From 138cff65470a2fd76d745159dbe7523127ef4f66 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 10 Sep 2020 21:02:06 +0200 Subject: [PATCH] fixed async inconsistency causing markAllAsRead to fail when switching channels --- .../gui/gxschannels/GxsChannelPostsModel.cpp | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp index a21d6ff90..797b2fb6f 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp @@ -696,16 +696,25 @@ void RsGxsChannelPostsModel::setAllMsgReadStatus(bool read_status) // No need to call preMods()/postMods() here because we're not changing the model // All operations below are done async - RsThread::async([this, read_status]() - { - for(uint32_t i=0;imarkRead(RsGxsGrpMsgIdPair(mPosts[i].mMeta.mGroupId,mPosts[i].mMeta.mMsgId),read_status)) - RsErr() << "setAllMsgReadStatus: failed to change status of msg " << mPosts[i].mMeta.mMsgId << " in group " << mPosts[i].mMeta.mGroupId << " to status " << read_status << std::endl; - } + std::vector pairs; + + for(uint32_t i=0;imarkRead(pairs[i],read_status)) + RsErr() << "setAllMsgReadStatus: failed to change status of msg " << pairs[i].first << " in group " << pairs[i].second << " to status " << read_status << std::endl; }); }