From 8e2a004d967dd3faea172fbed655b0b45c826d54 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Fri, 9 Jan 2015 19:38:12 +0000 Subject: SkypeClassic: Upmerge with leecher's repo: -Implemented Filetransfer extensions for receiving files and avatars via SkypeProxy (sending via SkypeProxy not working yet). -Added option to disable the check for SENT messages as newer Skype versions don't send this notification anymore. -Various little code fixes. Other changes: - Fixed memory leak - Fixed crash in x64 builds - Translation fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@11805 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeClassic/src/msglist.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'protocols/SkypeClassic/src/msglist.cpp') diff --git a/protocols/SkypeClassic/src/msglist.cpp b/protocols/SkypeClassic/src/msglist.cpp index aedb4d1257..9ba9b67679 100644 --- a/protocols/SkypeClassic/src/msglist.cpp +++ b/protocols/SkypeClassic/src/msglist.cpp @@ -3,6 +3,7 @@ #include "memlist.h" #include "debug.h" #include "msglist.h" +#include "filexfer.h" #define MSGLIST_TIMEOUT 1800 // Chatmessage references will be kept for 30 minutes @@ -18,9 +19,19 @@ void MsgList_Init(void) m_hMsgList = List_Init(128); } +void MsgList_FreeEntry(TYP_MSGLENTRY *pEntry) +{ + if (pEntry->pfts) + FXFreePFTS(pEntry->pfts); + HeapFree(GetProcessHeap(), 0, pEntry); +} + void MsgList_Exit(void) { if (!m_hMsgList) return; + TYP_MSGLENTRY *pEntry; + while (pEntry = (TYP_MSGLENTRY*) List_Pop(m_hMsgList)) + MsgList_FreeEntry(pEntry); List_FreeElements (m_hMsgList); List_Exit(m_hMsgList); m_hMsgList = NULL; @@ -33,7 +44,7 @@ TYP_MSGLENTRY *MsgList_Add(DWORD uMsgNum, HANDLE hEvent) BOOL bFound; LOG (("MsgList_Add (%d, %08X)", uMsgNum, hEvent)); - if (!m_hMsgList || !hEvent) return FALSE; + if (!m_hMsgList) return FALSE; bFound = List_BinarySearch(m_hMsgList,CmpProc,(void *)uMsgNum,&iListInd); if (!bFound) pEntry = (TYP_MSGLENTRY*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TYP_MSGLENTRY)); else pEntry = (TYP_MSGLENTRY*)List_ElementAt (m_hMsgList, iListInd); @@ -78,8 +89,7 @@ void MsgList_CollectGarbage(void) if (pEntry->t < t) { LOG (("MsgList_CollectGarbage throwing out msg %d", pEntry->uMsgNum)); - HeapFree (GetProcessHeap(), 0, List_RemoveElementAt (m_hMsgList, i)); - i--; + MsgList_FreeEntry((TYP_MSGLENTRY*)List_RemoveElementAt(m_hMsgList, i--)); } } } -- cgit v1.2.3