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