mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-22 21:31:07 -05:00
removed multiple references to temporary passed accross threads, causing random crashes
This commit is contained in:
parent
2ab012261b
commit
0ff4426d72
@ -186,13 +186,13 @@ void BaseBoardsCommentsItem::loadMessage()
|
|||||||
if (posts.size() == 1)
|
if (posts.size() == 1)
|
||||||
{
|
{
|
||||||
std::cerr << (void*)this << ": Obtained post, with msgId = " << posts[0].mMeta.mMsgId << std::endl;
|
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 );
|
RsQThreadUtils::postToObject( [post,this]() { setPost(post,true); mIsLoadingMessage = false;}, this );
|
||||||
}
|
}
|
||||||
else if(comments.size() == 1)
|
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;
|
std::cerr << (void*)this << ": Obtained comment, setting messageId to threadID = " << cmt.mMeta.mThreadId << std::endl;
|
||||||
|
|
||||||
RsQThreadUtils::postToObject( [cmt,this]()
|
RsQThreadUtils::postToObject( [cmt,this]()
|
||||||
|
@ -292,13 +292,13 @@ void ChannelsCommentsItem::loadMessage()
|
|||||||
#ifdef DEBUG_ITEM
|
#ifdef DEBUG_ITEM
|
||||||
std::cerr << (void*)this << ": Obtained post, with msgId = " << posts[0].mMeta.mMsgId << std::endl;
|
std::cerr << (void*)this << ": Obtained post, with msgId = " << posts[0].mMeta.mMsgId << std::endl;
|
||||||
#endif
|
#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 );
|
RsQThreadUtils::postToObject( [post,this]() { setPost(post); }, this );
|
||||||
}
|
}
|
||||||
else if(comments.size() == 1)
|
else if(comments.size() == 1)
|
||||||
{
|
{
|
||||||
const RsGxsComment& cmt = comments[0];
|
RsGxsComment cmt(comments[0]);
|
||||||
#ifdef DEBUG_ITEM
|
#ifdef DEBUG_ITEM
|
||||||
std::cerr << (void*)this << ": Obtained comment, setting messageId to threadID = " << cmt.mMeta.mThreadId << std::endl;
|
std::cerr << (void*)this << ": Obtained comment, setting messageId to threadID = " << cmt.mMeta.mThreadId << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
@ -125,7 +125,7 @@ void GxsForumGroupItem::loadGroup()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const RsGxsForumGroup& group(groups[0]);
|
RsGxsForumGroup group(groups[0]);// no reference to teporary accross threads!
|
||||||
|
|
||||||
RsQThreadUtils::postToObject( [group,this]()
|
RsQThreadUtils::postToObject( [group,this]()
|
||||||
{
|
{
|
||||||
|
@ -235,7 +235,7 @@ void GxsForumMsgItem::loadMessage()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const RsGxsForumMsg& msg(msgs[0]);
|
RsGxsForumMsg msg(msgs[0]);
|
||||||
|
|
||||||
RsQThreadUtils::postToObject( [msg,this]()
|
RsQThreadUtils::postToObject( [msg,this]()
|
||||||
{
|
{
|
||||||
@ -280,7 +280,7 @@ void GxsForumMsgItem::loadParentMessage(const RsGxsMessageId& parent_msg)
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const RsGxsForumMsg& msg(msgs[0]);
|
RsGxsForumMsg msg(msgs[0]);
|
||||||
|
|
||||||
RsQThreadUtils::postToObject( [msg,this]()
|
RsQThreadUtils::postToObject( [msg,this]()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user