mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 00:19:30 -05:00
removed memory leak caused by moving initretroshare to msgservice onstructor
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3540 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b0f0e4c380
commit
baac505c15
@ -38,6 +38,7 @@
|
||||
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <map>
|
||||
|
||||
const int msgservicezone = 54319;
|
||||
|
||||
@ -274,12 +275,15 @@ int p3MsgService::checkOutgoingMessages()
|
||||
std::list<RsItem*> p3MsgService::saveList(bool& cleanup)
|
||||
{
|
||||
|
||||
|
||||
std::list<RsItem*> itemList;
|
||||
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
std::map<uint32_t, RsMsgTagType* >::iterator mit2;
|
||||
std::map<uint32_t, RsMsgTags* >::iterator mit3;
|
||||
|
||||
MsgTagType stdTags;
|
||||
|
||||
cleanup = false;
|
||||
|
||||
mMsgMtx.lock();
|
||||
@ -355,7 +359,6 @@ void p3MsgService::initStandardTagTypes()
|
||||
|
||||
bool p3MsgService::loadList(std::list<RsItem*> load)
|
||||
{
|
||||
|
||||
RsMsgItem *mitem;
|
||||
RsMsgTagType* mtt;
|
||||
RsMsgTags* mti;
|
||||
@ -363,6 +366,7 @@ bool p3MsgService::loadList(std::list<RsItem*> load)
|
||||
|
||||
std::list<RsMsgItem*> items;
|
||||
std::list<RsItem*>::iterator it;
|
||||
std::map<uint32_t, RsMsgTagType*>::iterator tagIt;
|
||||
|
||||
// load items and calculate next unique msgId
|
||||
for(it = load.begin(); it != load.end(); it++)
|
||||
@ -377,9 +381,20 @@ bool p3MsgService::loadList(std::list<RsItem*> load)
|
||||
items.push_back(mitem);
|
||||
}
|
||||
else if(NULL != (mtt = dynamic_cast<RsMsgTagType *>(*it)))
|
||||
{
|
||||
// delete standard tags as they are now save in config
|
||||
if(mTags.end() == (tagIt = mTags.find(mtt->tagId)))
|
||||
{
|
||||
mTags.insert(std::pair<uint32_t, RsMsgTagType* >(mtt->tagId, mtt));
|
||||
}
|
||||
else
|
||||
{
|
||||
delete mTags[mtt->tagId];
|
||||
mTags.erase(tagIt);
|
||||
mTags.insert(std::pair<uint32_t, RsMsgTagType* >(mtt->tagId, mtt));
|
||||
}
|
||||
|
||||
}
|
||||
else if(NULL != (mti = dynamic_cast<RsMsgTags *>(*it)))
|
||||
{
|
||||
mMsgTags.insert(std::pair<uint32_t, RsMsgTags* >(mti->msgId, mti));
|
||||
|
Loading…
Reference in New Issue
Block a user