Merge pull request #2721 from csoler/v0.6-BugFixing_28

removed multiple references to temporary passed accross threads, caus…
This commit is contained in:
csoler 2023-04-25 11:34:19 +02:00 committed by GitHub
commit 242b5229d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 12 deletions

View File

@ -186,13 +186,13 @@ void BaseBoardsCommentsItem::loadMessage()
if (posts.size() == 1)
{
std::cerr << (void*)this << ": Obtained post, with msgId = " << posts[0].mMeta.mMsgId << std::endl;
const RsPostedPost& post(posts[0]);
RsPostedPost post(posts[0]); // no reference to temporary because it's passed to a thread!
RsQThreadUtils::postToObject( [post,this]() { setPost(post,true); mIsLoadingMessage = false;}, this );
}
else if(comments.size() == 1)
{
const RsGxsComment& cmt = comments[0];
RsGxsComment cmt(comments[0]);
std::cerr << (void*)this << ": Obtained comment, setting messageId to threadID = " << cmt.mMeta.mThreadId << std::endl;
RsQThreadUtils::postToObject( [cmt,this]()

View File

@ -292,13 +292,13 @@ void ChannelsCommentsItem::loadMessage()
#ifdef DEBUG_ITEM
std::cerr << (void*)this << ": Obtained post, with msgId = " << posts[0].mMeta.mMsgId << std::endl;
#endif
const RsGxsChannelPost& post(posts[0]);
RsGxsChannelPost post(posts[0]); // no reference to temporary here, because we pass this to a thread
RsQThreadUtils::postToObject( [post,this]() { setPost(post); }, this );
}
else if(comments.size() == 1)
{
const RsGxsComment& cmt = comments[0];
RsGxsComment cmt(comments[0]);
#ifdef DEBUG_ITEM
std::cerr << (void*)this << ": Obtained comment, setting messageId to threadID = " << cmt.mMeta.mThreadId << std::endl;
#endif

View File

@ -125,7 +125,7 @@ void GxsForumGroupItem::loadGroup()
std::cerr << std::endl;
return;
}
const RsGxsForumGroup& group(groups[0]);
RsGxsForumGroup group(groups[0]);// no reference to teporary accross threads!
RsQThreadUtils::postToObject( [group,this]()
{

View File

@ -235,7 +235,7 @@ void GxsForumMsgItem::loadMessage()
std::cerr << std::endl;
return;
}
const RsGxsForumMsg& msg(msgs[0]);
RsGxsForumMsg msg(msgs[0]);
RsQThreadUtils::postToObject( [msg,this]()
{
@ -280,7 +280,7 @@ void GxsForumMsgItem::loadParentMessage(const RsGxsMessageId& parent_msg)
std::cerr << std::endl;
return;
}
const RsGxsForumMsg& msg(msgs[0]);
RsGxsForumMsg msg(msgs[0]);
RsQThreadUtils::postToObject( [msg,this]()
{

View File

@ -173,11 +173,7 @@ void RsGxsChannelPostsModel::updateFilter(uint32_t& count)
{
preMods();
beginResetModel();
mFilteredPosts.clear();
//mFilteredPosts.push_back(0);
endResetModel();
for(size_t i=0;i<mPosts.size();++i)
if(postPassesFilter(mPosts[i],mFilteredStrings,mFilterUnread))

View File

@ -379,7 +379,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
connect(ui->viewType_TB,SIGNAL(clicked()),this,SLOT(switchView()));
ui->showUnread_TB->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-unread.png"));
ui->showUnread_TB->setChecked(false);
whileBlocking(ui->showUnread_TB)->setChecked(false);
ui->showUnread_TB->setToolTip(tr("Show unread posts only"));
connect(ui->showUnread_TB,SIGNAL(toggled(bool)),this,SLOT(switchOnlyUnread(bool)));