mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
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:
parent
4fd3ab6123
commit
16b1dd7eb1
@ -619,6 +619,7 @@ void p3ChatService::receiveStateString(const std::string& id,const std::string&
|
|||||||
_state_strings[id]._peer_is_new = true ;
|
_state_strings[id]._peer_is_new = true ;
|
||||||
_state_strings[id]._own_is_new = new_peer ;
|
_state_strings[id]._own_is_new = new_peer ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3ChatService::receiveAvatarJpegData(RsChatAvatarItem *ci)
|
void p3ChatService::receiveAvatarJpegData(RsChatAvatarItem *ci)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
|
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
|
||||||
@ -628,6 +629,9 @@ void p3ChatService::receiveAvatarJpegData(RsChatAvatarItem *ci)
|
|||||||
|
|
||||||
bool new_peer = (_avatars.find(ci->PeerId()) == _avatars.end()) ;
|
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()] = new AvatarInfo(ci->image_data,ci->image_size) ;
|
||||||
_avatars[ci->PeerId()]->_peer_is_new = true ;
|
_avatars[ci->PeerId()]->_peer_is_new = true ;
|
||||||
_avatars[ci->PeerId()]->_own_is_new = new_peer ;
|
_avatars[ci->PeerId()]->_own_is_new = new_peer ;
|
||||||
|
Loading…
Reference in New Issue
Block a user