mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
removed std::unique_ptr in a few places where it made code far too complicated and less easy to debug
This commit is contained in:
parent
1ecfbfcd02
commit
41a263eccc
@ -505,16 +505,16 @@ void IdDialog::updateCircles()
|
||||
|
||||
/* This can be big so use a smart pointer to just copy the pointer
|
||||
* instead of copying the whole list accross the lambdas */
|
||||
auto circle_metas = std::make_unique<std::list<RsGroupMetaData>>();
|
||||
auto circle_metas = new std::list<RsGroupMetaData>();
|
||||
|
||||
if(!rsGxsCircles->getCirclesSummaries(*circle_metas))
|
||||
{
|
||||
RS_ERR("failed to retrieve circles group info list");
|
||||
delete circle_metas;
|
||||
return;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject(
|
||||
[circle_metas = std::move(circle_metas), this]()
|
||||
RsQThreadUtils::postToObject( [circle_metas, this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
@ -522,7 +522,8 @@ void IdDialog::updateCircles()
|
||||
|
||||
loadCircles(*circle_metas);
|
||||
|
||||
}, this );
|
||||
delete circle_metas;
|
||||
}, this );
|
||||
|
||||
});
|
||||
}
|
||||
@ -1316,17 +1317,19 @@ void IdDialog::updateIdList()
|
||||
return;
|
||||
}
|
||||
|
||||
auto ids_set = std::make_unique<std::map<RsGxsGroupId,RsGxsIdGroup>>();
|
||||
auto ids_set = new std::map<RsGxsGroupId,RsGxsIdGroup>();
|
||||
|
||||
for(auto it(groups.begin()); it!=groups.end(); ++it)
|
||||
(*ids_set)[(*it).mMeta.mGroupId] = *it;
|
||||
|
||||
RsQThreadUtils::postToObject(
|
||||
[ids_set = std::move(ids_set), this] ()
|
||||
RsQThreadUtils::postToObject( [ids_set, this] ()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
loadIdentities(*ids_set);
|
||||
delete ids_set;
|
||||
|
||||
}, this );
|
||||
|
||||
});
|
||||
|
@ -256,17 +256,20 @@ void FriendSelectionWidget::loadIdentities()
|
||||
return;
|
||||
}
|
||||
|
||||
auto ids = std::make_unique<std::vector<RsGxsGroupId>>();
|
||||
for(auto& meta: ids_meta) ids->push_back(meta.mGroupId);
|
||||
auto ids = new std::vector<RsGxsGroupId>();
|
||||
|
||||
RsQThreadUtils::postToObject(
|
||||
[ids = std::move(ids), this]()
|
||||
for(auto& meta: ids_meta)
|
||||
ids->push_back(meta.mGroupId);
|
||||
|
||||
RsQThreadUtils::postToObject( [ids, this]()
|
||||
{
|
||||
// We do that is the GUI thread. Dont try it on another thread!
|
||||
gxsIds = *ids;
|
||||
/* TODO: To furter optimize away a copy gxsIds could be a unique_ptr
|
||||
* too */
|
||||
fillList();
|
||||
|
||||
delete ids;
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
@ -464,17 +464,16 @@ void GxsTransportStatistics::loadGroups()
|
||||
#ifdef DEBUG_FORUMS
|
||||
std::cerr << "Retrieving post data for post " << mThreadId << std::endl;
|
||||
#endif
|
||||
auto stats = std::make_unique<
|
||||
std::map<RsGxsGroupId,RsGxsTransGroupStatistics> >();
|
||||
auto stats = new std::map<RsGxsGroupId,RsGxsTransGroupStatistics>();
|
||||
|
||||
if(!rsGxsTrans->getGroupStatistics(*stats))
|
||||
{
|
||||
RS_ERR("Cannot retrieve group statistics in GxsTransportStatistics");
|
||||
delete stats;
|
||||
return;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject(
|
||||
[stats = std::move(stats), this]()
|
||||
RsQThreadUtils::postToObject( [stats, this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
@ -485,7 +484,8 @@ void GxsTransportStatistics::loadGroups()
|
||||
updateContent();
|
||||
mStateHelper->setLoading(GXSTRANS_GROUP_META, false);
|
||||
|
||||
}, this );
|
||||
delete stats;
|
||||
}, this );
|
||||
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user