fixed bug causing bad cache update

This commit is contained in:
csoler 2021-01-02 23:56:26 +01:00
parent a6010beab3
commit ef21db0a0a
3 changed files with 5 additions and 9 deletions

View File

@ -838,7 +838,8 @@ int RsDataService::storeMessage(const std::list<RsNxsMsg*>& msg)
// This is needed so that mLastPost is correctly updated in the group meta when it is re-loaded.
mMsgMetaDataCache[msgMetaPtr->mGroupId].updateMeta(msgMetaPtr->mMsgId,*msgMetaPtr);
if(mUseCache)
mMsgMetaDataCache[msgMetaPtr->mGroupId].updateMeta(msgMetaPtr->mMsgId,*msgMetaPtr);
delete *mit;
}

View File

@ -81,12 +81,7 @@ public:
void updateMeta(const ID& id,const MetaDataClass& meta)
{
auto it = mMetas.find(id) ;
if(it != mMetas.end())
*(it->second) = meta ;
else
mMetas[id] = std::make_shared<MetaDataClass>();
mMetas[id] = std::make_shared<MetaDataClass>(meta); // create a new shared_ptr to possibly replace the previous one
}
void clear(const ID& id)

View File

@ -216,8 +216,8 @@ void GxsForumMsgItem::loadGroup()
void GxsForumMsgItem::loadMessage()
{
#ifdef DEBUG_ITEM
std::cerr << "GxsForumMsgItem::loadMessage()";
#ifndef DEBUG_ITEM
std::cerr << "GxsForumMsgItem::loadMessage(): messageId=" << messageId() << " groupId=" << groupId() ;
std::cerr << std::endl;
#endif