mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
GXS:
- fixed some possible crashs with dynamic_cast - fixed memory leak in p3GxsCircles::cache_load_for_token and p3Posted::background_loadMsgs git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6532 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fef4a87c7c
commit
c3303a1969
@ -840,6 +840,12 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
|
|||||||
for(; vit != grpData.end(); vit++)
|
for(; vit != grpData.end(); vit++)
|
||||||
{
|
{
|
||||||
RsGxsCircleGroupItem *item = dynamic_cast<RsGxsCircleGroupItem*>(*vit);
|
RsGxsCircleGroupItem *item = dynamic_cast<RsGxsCircleGroupItem*>(*vit);
|
||||||
|
if (!item)
|
||||||
|
{
|
||||||
|
std::cerr << "Not a RsGxsCircleGroupItem Item, deleting!" << std::endl;
|
||||||
|
delete(*vit);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
RsGxsCircleGroup group;
|
RsGxsCircleGroup group;
|
||||||
item->convertTo(group);
|
item->convertTo(group);
|
||||||
|
|
||||||
@ -861,6 +867,7 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
|
|||||||
std::cerr << "p3GxsCircles::cache_load_for_token() Load ERROR: ";
|
std::cerr << "p3GxsCircles::cache_load_for_token() Load ERROR: ";
|
||||||
std::cerr << item->meta;
|
std::cerr << item->meta;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
delete(item);
|
||||||
// ERROR.
|
// ERROR.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -960,6 +960,12 @@ bool p3IdService::cache_load_for_token(uint32_t token)
|
|||||||
for(; vit != grpData.end(); vit++)
|
for(; vit != grpData.end(); vit++)
|
||||||
{
|
{
|
||||||
RsGxsIdGroupItem* item = dynamic_cast<RsGxsIdGroupItem*>(*vit);
|
RsGxsIdGroupItem* item = dynamic_cast<RsGxsIdGroupItem*>(*vit);
|
||||||
|
if (!item)
|
||||||
|
{
|
||||||
|
std::cerr << "Not a RsGxsIdGroupItem Item, deleting!" << std::endl;
|
||||||
|
delete(*vit);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_IDS
|
#ifdef DEBUG_IDS
|
||||||
std::cerr << "p3IdService::cache_load_for_token() Loaded Id with Meta: ";
|
std::cerr << "p3IdService::cache_load_for_token() Loaded Id with Meta: ";
|
||||||
@ -982,8 +988,6 @@ bool p3IdService::cache_load_for_token(uint32_t token)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool p3IdService::cache_update_if_cached(const RsGxsId &id, std::string serviceString)
|
bool p3IdService::cache_update_if_cached(const RsGxsId &id, std::string serviceString)
|
||||||
{
|
{
|
||||||
/* if these entries are cached - update with new info */
|
/* if these entries are cached - update with new info */
|
||||||
@ -1070,7 +1074,12 @@ bool p3IdService::cache_load_ownids(uint32_t token)
|
|||||||
for(vit = grpData.begin(); vit != grpData.end(); vit++)
|
for(vit = grpData.begin(); vit != grpData.end(); vit++)
|
||||||
{
|
{
|
||||||
RsGxsIdGroupItem* item = dynamic_cast<RsGxsIdGroupItem*>(*vit);
|
RsGxsIdGroupItem* item = dynamic_cast<RsGxsIdGroupItem*>(*vit);
|
||||||
|
if (!item)
|
||||||
|
{
|
||||||
|
std::cerr << "Not a IdOpinion Item, deleting!" << std::endl;
|
||||||
|
delete(*vit);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (item->meta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
|
if (item->meta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
|
||||||
{
|
{
|
||||||
@ -1080,8 +1089,8 @@ bool p3IdService::cache_load_ownids(uint32_t token)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to cache these items...
|
// No need to cache these items...
|
||||||
// as it just causes the cache to be flushed.
|
// as it just causes the cache to be flushed.
|
||||||
#if 0
|
#if 0
|
||||||
// Cache Items too.
|
// Cache Items too.
|
||||||
for(vit = grpData.begin(); vit != grpData.end(); vit++)
|
for(vit = grpData.begin(); vit != grpData.end(); vit++)
|
||||||
@ -1112,7 +1121,6 @@ bool p3IdService::cache_load_ownids(uint32_t token)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
/************************************************************************************/
|
/************************************************************************************/
|
||||||
|
|
||||||
|
@ -902,6 +902,7 @@ void p3Posted::background_loadMsgs(const uint32_t &token, bool unprocessed)
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
std::cerr << "p3Posted::background_loadMsgs() ERROR This should not happen";
|
std::cerr << "p3Posted::background_loadMsgs() ERROR This should not happen";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
delete(*vit);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -999,6 +1000,7 @@ void p3Posted::background_loadMsgs(const uint32_t &token, bool unprocessed)
|
|||||||
RsGxsGrpMsgIdPair msgId = std::make_pair(groupId, (*vit)->meta.mMsgId);
|
RsGxsGrpMsgIdPair msgId = std::make_pair(groupId, (*vit)->meta.mMsgId);
|
||||||
RsGenExchange::setMsgStatusFlags(token_a, msgId, 0, GXS_SERV::GXS_MSG_STATUS_UNPROCESSED);
|
RsGenExchange::setMsgStatusFlags(token_a, msgId, 0, GXS_SERV::GXS_MSG_STATUS_UNPROCESSED);
|
||||||
}
|
}
|
||||||
|
delete(*vit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user