summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-08 20:55:34 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-08 20:55:34 +0000
commita4498f183c28fb10af04e94d1236b795b06bf7a5 (patch)
treef0aba6d3cbfd14ba41e53b7161e020af9200dc09
parent7e2a1c233ab2eac8e3f65dd1ee1647b336ef588c (diff)
some memory leak fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@3925 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_db_int.h2
-rw-r--r--plugins/Folders/src/folderItem.cpp1
-rw-r--r--plugins/MyDetails/src/frame.cpp4
-rw-r--r--src/core/modules.cpp16
-rw-r--r--src/modules/database/database.h2
-rw-r--r--src/modules/database/dbintf.cpp8
6 files changed, 23 insertions, 10 deletions
diff --git a/include/m_db_int.h b/include/m_db_int.h
index 8961f84fc9..a66aa3a5dd 100644
--- a/include/m_db_int.h
+++ b/include/m_db_int.h
@@ -53,7 +53,7 @@ struct DBCachedContact
DBCachedContactValue* last;
};
-interface MIDatabaseCache
+interface MIDatabaseCache : public MZeroedObject
{
STDMETHOD_(DBCachedContact*,AddContactToCache)(HANDLE hContact) PURE;
STDMETHOD_(DBCachedContact*,GetCachedContact)(HANDLE hContact) PURE;
diff --git a/plugins/Folders/src/folderItem.cpp b/plugins/Folders/src/folderItem.cpp
index 4125d43d4a..f89f001619 100644
--- a/plugins/Folders/src/folderItem.cpp
+++ b/plugins/Folders/src/folderItem.cpp
@@ -40,6 +40,7 @@ CFolderItem::~CFolderItem()
mir_free(m_szName);
mir_free(m_tszFormat);
mir_free(m_tszOldFormat);
+ mir_free(m_tszUserName);
}
void CFolderItem::SetFormat(const TCHAR *newFormat)
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp
index 61a4f9d0c6..795d3b1a48 100644
--- a/plugins/MyDetails/src/frame.cpp
+++ b/plugins/MyDetails/src/frame.cpp
@@ -1121,7 +1121,7 @@ void Draw(HWND hwnd, HDC hdc_orig)
HDC hdc = CreateCompatibleDC(hdc_orig);
HBITMAP hBmp = CreateBitmap32(r.right,r.bottom);
- SelectObject(hdc, hBmp);
+ HBITMAP old_bitmap = (HBITMAP)SelectObject(hdc, hBmp);
int old_bk_mode = SetBkMode(hdc, TRANSPARENT);
HFONT old_font = (HFONT) SelectObject(hdc, hFont[0]);
@@ -1369,6 +1369,8 @@ void Draw(HWND hwnd, HDC hdc_orig)
BitBlt(hdc_orig, r_full.left, r_full.top, r_full.right - r_full.left,
r_full.bottom - r_full.top, hdc, r_full.left, r_full.top, SRCCOPY);
+
+ SelectObject(hdc, old_bitmap);
DeleteDC(hdc);
DeleteObject(hBmp);
}
diff --git a/src/core/modules.cpp b/src/core/modules.cpp
index d06858a6c9..1eb92eab3c 100644
--- a/src/core/modules.cpp
+++ b/src/core/modules.cpp
@@ -66,21 +66,23 @@ int LoadDefaultServiceModePlugin(void);
int LoadErrorsModule(void);
int LoadStdPlugins(void);
-void UnloadUtilsModule(void);
+void UnloadAccountsModule(void);
void UnloadButtonModule(void);
void UnloadClcModule(void);
void UnloadContactListModule(void);
void UnloadDatabase(void);
+void UnloadDbintfModule(void);
+void UnloadErrorsModule(void);
void UnloadEventsModule(void);
-void UnloadSslModule(void);
+void UnloadExtraIconsModule(void);
+void UnloadIcoLibModule(void);
void UnloadNetlibModule(void);
void UnloadNewPlugins(void);
-void UnloadIcoLibModule(void);
+void UnloadProtocolsModule(void);
void UnloadSkinSounds(void);
void UnloadSkinHotkeys(void);
-void UnloadProtocolsModule(void);
-void UnloadAccountsModule(void);
-void UnloadErrorsModule(void);
+void UnloadSslModule(void);
+void UnloadUtilsModule(void);
int LoadIcoTabsModule();
int LoadHeaderbarModule();
@@ -171,10 +173,12 @@ void UnloadDefaultModules(void)
// UnloadErrorsModule();
UnloadIcoLibModule();
UnloadUtilsModule();
+ UnloadExtraIconsModule();
UnloadButtonModule();
UnloadClcModule();
UnloadContactListModule();
UnloadEventsModule();
UnloadNetlibModule();
+ UnloadDbintfModule();
UnloadSslModule();
}
diff --git a/src/modules/database/database.h b/src/modules/database/database.h
index eefdd3217c..e484d341e5 100644
--- a/src/modules/database/database.h
+++ b/src/modules/database/database.h
@@ -21,7 +21,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-class MDatabaseCache : public MIDatabaseCache, public MZeroedObject
+class MDatabaseCache : public MIDatabaseCache
{
HANDLE m_hCacheHeap;
char* m_lastSetting;
diff --git a/src/modules/database/dbintf.cpp b/src/modules/database/dbintf.cpp
index 70d033c50c..e95caff6c4 100644
--- a/src/modules/database/dbintf.cpp
+++ b/src/modules/database/dbintf.cpp
@@ -232,8 +232,9 @@ static INT_PTR srvDestroyInstance(WPARAM wParam,LPARAM lParam)
{
MIDatabase* pDb = (MIDatabase*)lParam;
if (pDb != NULL) {
- delete pDb->m_cache;
+ MDatabaseCache *pCache = (MDatabaseCache*)pDb->m_cache;
pDb->m_cache = NULL;
+ delete pCache;
}
return 0;
}
@@ -284,3 +285,8 @@ int LoadDbintfModule()
CreateServiceFunction(MS_DB_DESTROY_INSTANCE, srvDestroyInstance);
return 0;
}
+
+void UnloadDbintfModule()
+{
+ arDbPlugins.destroy();
+}