Remove memory leak in p3ChatService::receiveAvatarJpegData, when a peer changed the avatar.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3481 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-09-13 20:28:21 +00:00
parent 4fd3ab6123
commit 16b1dd7eb1

View File

@ -619,6 +619,7 @@ void p3ChatService::receiveStateString(const std::string& id,const std::string&
_state_strings[id]._peer_is_new = true ;
_state_strings[id]._own_is_new = new_peer ;
}
void p3ChatService::receiveAvatarJpegData(RsChatAvatarItem *ci)
{
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
@ -628,6 +629,9 @@ void p3ChatService::receiveAvatarJpegData(RsChatAvatarItem *ci)
bool new_peer = (_avatars.find(ci->PeerId()) == _avatars.end()) ;
if (new_peer == false && _avatars[ci->PeerId()]) {
delete _avatars[ci->PeerId()];
}
_avatars[ci->PeerId()] = new AvatarInfo(ci->image_data,ci->image_size) ;
_avatars[ci->PeerId()]->_peer_is_new = true ;
_avatars[ci->PeerId()]->_own_is_new = new_peer ;