mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed memory leak in deleteGroup and removed unnecessary pointer in the functions called below
This commit is contained in:
parent
a545481daa
commit
cf2edb50b4
@ -1668,11 +1668,11 @@ void RsGenExchange::updateGroup(uint32_t& token, RsGxsGrpItem* grpItem)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGenExchange::deleteGroup(uint32_t& token, RsGxsGrpItem* grpItem)
|
void RsGenExchange::deleteGroup(uint32_t& token, const RsGxsGroupId& grpId)
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mGenMtx) ;
|
RS_STACK_MUTEX(mGenMtx) ;
|
||||||
token = mDataAccess->generatePublicToken();
|
token = mDataAccess->generatePublicToken();
|
||||||
mGroupDeletePublish.push_back(GroupDeletePublish(grpItem, token));
|
mGroupDeletePublish.push_back(GroupDeletePublish(grpId, token));
|
||||||
|
|
||||||
#ifdef GEN_EXCH_DEBUG
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << "RsGenExchange::deleteGroup() token: " << token;
|
std::cerr << "RsGenExchange::deleteGroup() token: " << token;
|
||||||
@ -2319,14 +2319,10 @@ void RsGenExchange::processGroupDelete()
|
|||||||
std::vector<GroupDeletePublish>::iterator vit = mGroupDeletePublish.begin();
|
std::vector<GroupDeletePublish>::iterator vit = mGroupDeletePublish.begin();
|
||||||
for(; vit != mGroupDeletePublish.end(); ++vit)
|
for(; vit != mGroupDeletePublish.end(); ++vit)
|
||||||
{
|
{
|
||||||
GroupDeletePublish& gdp = *vit;
|
|
||||||
uint32_t token = gdp.mToken;
|
|
||||||
const RsGxsGroupId& groupId = gdp.grpItem->meta.mGroupId;
|
|
||||||
std::vector<RsGxsGroupId> gprIds;
|
std::vector<RsGxsGroupId> gprIds;
|
||||||
gprIds.push_back(groupId);
|
gprIds.push_back(vit->mGroupId);
|
||||||
mDataStore->removeGroups(gprIds);
|
mDataStore->removeGroups(gprIds);
|
||||||
toNotify.insert(std::make_pair(
|
toNotify.insert(std::make_pair( vit->mToken, GrpNote(true, vit->mGroupId)));
|
||||||
token, GrpNote(true, groupId)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ protected:
|
|||||||
* @param token
|
* @param token
|
||||||
* @param grpItem
|
* @param grpItem
|
||||||
*/
|
*/
|
||||||
void deleteGroup(uint32_t& token, RsGxsGrpItem* grpItem);
|
void deleteGroup(uint32_t& token, const RsGxsGroupId &grpId);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
|
@ -222,9 +222,9 @@ public:
|
|||||||
class GroupDeletePublish
|
class GroupDeletePublish
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GroupDeletePublish(RsGxsGrpItem* item, uint32_t token)
|
GroupDeletePublish(const RsGxsGroupId& grpId, uint32_t token)
|
||||||
: grpItem(item), mToken(token) {}
|
: mGroupId(grpId), mToken(token) {}
|
||||||
RsGxsGrpItem* grpItem;
|
RsGxsGroupId mGroupId;
|
||||||
uint32_t mToken;
|
uint32_t mToken;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1433,17 +1433,14 @@ bool p3IdService::updateGroup(uint32_t& token, RsGxsIdGroup &group)
|
|||||||
|
|
||||||
bool p3IdService::deleteGroup(uint32_t& token, RsGxsIdGroup &group)
|
bool p3IdService::deleteGroup(uint32_t& token, RsGxsIdGroup &group)
|
||||||
{
|
{
|
||||||
RsGxsId id = RsGxsId(group.mMeta.mGroupId.toStdString());
|
RsGxsId id(group.mMeta.mGroupId);
|
||||||
RsGxsIdGroupItem* item = new RsGxsIdGroupItem();
|
|
||||||
|
|
||||||
item->fromGxsIdGroup(group,false) ;
|
|
||||||
|
|
||||||
#ifdef DEBUG_IDS
|
#ifdef DEBUG_IDS
|
||||||
std::cerr << "p3IdService::deleteGroup() Deleting RsGxsId: " << id;
|
std::cerr << "p3IdService::deleteGroup() Deleting RsGxsId: " << id;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RsGenExchange::deleteGroup(token, item);
|
RsGenExchange::deleteGroup(token,group.mMeta.mGroupId);
|
||||||
|
|
||||||
// if its in the cache - clear it.
|
// if its in the cache - clear it.
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user