Merge pull request #2630 from thunder2/fix-crash-forummsgitem

Fixed crash when closing forum message item in activity stream with s…
This commit is contained in:
csoler 2022-08-05 22:10:24 +02:00 committed by GitHub
commit ad7ae6905c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -411,7 +411,7 @@ void GxsForumMsgItem::doExpand(bool open)
ui->parentFrame->show();
}
setAsRead();
setAsRead(true);
}
else
{
@ -459,7 +459,7 @@ void GxsForumMsgItem::readAndClearItem()
std::cerr << std::endl;
#endif
setAsRead();
setAsRead(false);
removeItem();
}
@ -473,7 +473,7 @@ void GxsForumMsgItem::unsubscribeForum()
unsubscribe();
}
void GxsForumMsgItem::setAsRead()
void GxsForumMsgItem::setAsRead(bool doUpdate)
{
if (mInFill) {
return;
@ -481,14 +481,16 @@ void GxsForumMsgItem::setAsRead()
mCloseOnRead = false;
RsThread::async( [this]() {
RsThread::async( [this, doUpdate]() {
RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId());
rsGxsForums->markRead(msgPair, true);
if (doUpdate) {
RsQThreadUtils::postToObject( [this]() {
setReadStatus(false, true);
} );
}
});
}

View File

@ -82,7 +82,7 @@ private:
void fillParentMessage();
void fillExpandFrame();
void setReadStatus(bool isNew, bool isUnread);
void setAsRead();
void setAsRead(bool doUpdate);
private:
bool mInFill;