mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
added some tests to insertGroupData() to avoid inconsistent calls
This commit is contained in:
parent
ac02b68b34
commit
fa8968797c
@ -1193,7 +1193,7 @@ int RsServer::StartupRetroShare()
|
||||
std::cerr << "(EE) Cannot create extensions directory " << extensions_dir
|
||||
<< ". This is not mandatory, but you probably have a permission problem." << std::endl;
|
||||
|
||||
#ifdef DEBUG_PLUGIN_SYSTEM
|
||||
#ifndef DEBUG_PLUGIN_SYSTEM
|
||||
plugins_directories.push_back(".") ; // this list should be saved/set to some correct value.
|
||||
// possible entries include: /usr/lib/retroshare, ~/.retroshare/extensions/, etc.
|
||||
#endif
|
||||
|
@ -185,7 +185,7 @@ void GxsMessageFramePostWidget::loadGroupData()
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
RsGxsGenericGroupData *data;
|
||||
RsGxsGenericGroupData *data = nullptr;
|
||||
getGroupData(data);
|
||||
|
||||
if(!data)
|
||||
|
@ -515,7 +515,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool re
|
||||
|
||||
if(item)
|
||||
{
|
||||
std::set<RsGxsMessageId> older_versions(item->olderVersions());
|
||||
std::set<RsGxsMessageId> older_versions(item->olderVersions()); // we make a copy because the item will be deleted
|
||||
ui->feedWidget->removeFeedItem(item) ;
|
||||
|
||||
older_versions.insert(meta.mMsgId);
|
||||
@ -792,9 +792,16 @@ void GxsChannelPostsWidget::toggleAutoDownload()
|
||||
|
||||
bool GxsChannelPostsWidget::insertGroupData(const RsGxsGenericGroupData *data)
|
||||
{
|
||||
insertChannelDetails(*dynamic_cast<const RsGxsChannelGroup*>(data));
|
||||
return true;
|
||||
const RsGxsChannelGroup *d = dynamic_cast<const RsGxsChannelGroup*>(data);
|
||||
|
||||
if(!d)
|
||||
{
|
||||
RsErr() << __PRETTY_FUNCTION__ << " Cannot dynamic cast input data (" << (void*)data << " to RsGxsGenericGroupData. Something bad happenned." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
insertChannelDetails(*d);
|
||||
return true;
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidget::getMsgData(const std::set<RsGxsMessageId>& msgIds,std::vector<RsGxsGenericMsgData*>& psts)
|
||||
@ -825,6 +832,11 @@ void GxsChannelPostsWidget::getAllMsgData(std::vector<RsGxsGenericMsgData*>& pst
|
||||
|
||||
bool GxsChannelPostsWidget::getGroupData(RsGxsGenericGroupData *& data)
|
||||
{
|
||||
if(groupId().isNull())
|
||||
{
|
||||
RsErr() << __PRETTY_FUNCTION__ << " Trying to get data about null group!!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
|
||||
if(rsGxsChannels->getChannelsInfo(std::list<RsGxsGroupId>({groupId()}),groups) && groups.size()==1)
|
||||
@ -851,7 +863,7 @@ void GxsChannelPostsWidget::insertAllPosts(const std::vector<RsGxsGenericMsgData
|
||||
{
|
||||
std::vector<RsGxsChannelPost> cposts;
|
||||
|
||||
for(auto post: posts) // This is not so nice but we have somehow to convert to RsGxsChannelPost at some timer, and the cposts list is being modified in the insert method.
|
||||
for(auto post: posts) // This is not so nice but we have somehow to convert to RsGxsChannelPost at some time, and the cposts list is being modified in the insert method.
|
||||
cposts.push_back(*static_cast<RsGxsChannelPost*>(post));
|
||||
|
||||
insertChannelPosts(cposts, thread, false);
|
||||
|
@ -817,8 +817,11 @@ void GxsForumThreadWidget::changedThread(QModelIndex index)
|
||||
bool setToReadOnActive = Settings->getForumMsgSetToReadOnActivate();
|
||||
|
||||
if(setToReadOnActive)
|
||||
{
|
||||
saveExpandedItems(mSavedExpandedMessages);
|
||||
mThreadModel->setMsgReadStatus(src_index, true,false);
|
||||
}
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
||||
{
|
||||
@ -837,6 +840,7 @@ void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
||||
|
||||
if (index.column() == RsGxsForumModel::COLUMN_THREAD_READ)
|
||||
{
|
||||
saveExpandedItems(mSavedExpandedMessages);
|
||||
ForumModelPostEntry fmpe;
|
||||
|
||||
QModelIndex src_index = mThreadProxyModel->mapToSource(index);
|
||||
@ -845,6 +849,7 @@ void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
||||
#ifdef DEBUG_FORUMS
|
||||
std::cerr << "Setting message read status to false" << std::endl;
|
||||
#endif
|
||||
|
||||
mThreadModel->setMsgReadStatus(src_index, IS_MSG_UNREAD(fmpe.mMsgStatus),false);
|
||||
}
|
||||
#ifdef DEBUG_FORUMS
|
||||
@ -1266,6 +1271,7 @@ void GxsForumThreadWidget::markMsgAsReadUnread (bool read, bool children, bool f
|
||||
if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags)) {
|
||||
return;
|
||||
}
|
||||
saveExpandedItems(mSavedExpandedMessages);
|
||||
|
||||
if(forum)
|
||||
mThreadModel->setMsgReadStatus(mThreadModel->root(),read,children);
|
||||
|
Loading…
Reference in New Issue
Block a user