From d3706e3476a8b53e687b4d30324982b860b98c84 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 18 Jul 2014 22:59:17 +0000 Subject: - wiped out very impressive font reloading on exit; - all GDI handles now closed git-svn-id: http://svn.miranda-ng.org/main/trunk@9857 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/chat/main.cpp | 7 +++++ plugins/TabSRMM/src/commonheaders.h | 55 ++++++++++++++++++++----------------- plugins/TabSRMM/src/globals.cpp | 4 +++ plugins/TabSRMM/src/msgs.cpp | 1 - plugins/TabSRMM/src/tabctrl.cpp | 9 ++---- plugins/TabSRMM/src/themes.cpp | 8 ++++-- plugins/TabSRMM/src/version.h | 2 +- 7 files changed, 50 insertions(+), 36 deletions(-) diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index 8d1bf58ffc..da76841f5f 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -319,6 +319,13 @@ int Chat_Load() // unload the module. final cleanup int Chat_Unload(void) { + if (g_Settings.SelectionBGBrush) + DeleteObject(g_Settings.SelectionBGBrush); + + for (int i = 0; i < SIZEOF(g_Settings.UserListFonts); i++) + if (g_Settings.UserListFonts[i]) + DeleteObject(g_Settings.UserListFonts[i]); + delete g_Settings.Highlight; db_set_w(NULL, CHAT_MODULE, "SplitterX", (WORD)g_Settings.iSplitterX); diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h index e8a808b06f..99f5890497 100644 --- a/plugins/TabSRMM/src/commonheaders.h +++ b/plugins/TabSRMM/src/commonheaders.h @@ -252,31 +252,36 @@ extern HANDLE hUserPrefsWindowList; extern TCpTable cpTable[]; extern HMODULE g_hIconDLL; extern HMENU g_hMenu; - -extern int LoadSendRecvMessageModule(void); -extern int SplitmsgShutdown(void); -extern void LogErrorMessage(HWND hwndDlg, TWindowData *dat, int i, TCHAR *szMsg); -extern int Chat_Load(), Chat_Unload(); -extern void FreeLogFonts(); -extern INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -extern HIMAGELIST CreateStateImageList(); -extern INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam); -extern INT_PTR SendMessageCommand_W(WPARAM wParam, LPARAM lParam); -extern void ImageDataInsertBitmap(IRichEditOle *ole, HBITMAP hBm); -extern int CacheIconToBMP(TLogIcon *theIcon, HICON hIcon, COLORREF backgroundColor, int sizeX, int sizeY); -extern void DeleteCachedIcon(TLogIcon *theIcon); -extern INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -extern INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -extern INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -extern INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); -extern INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); -extern INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); -extern INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); -extern INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); -extern INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -extern int TSAPI TBStateConvert2Flat(int state); -extern int TSAPI RBStateConvert2Flat(int state); -extern void TSAPI FillTabBackground(const HDC hdc, int iStateId, const TWindowData *dat, RECT* rc); +extern bool g_bShutdown; + +int LoadSendRecvMessageModule(void); +int SplitmsgShutdown(void); +void LogErrorMessage(HWND hwndDlg, TWindowData *dat, int i, TCHAR *szMsg); +int Chat_Load(), Chat_Unload(); +void FreeLogFonts(); +void ImageDataInsertBitmap(IRichEditOle *ole, HBITMAP hBm); +int CacheIconToBMP(TLogIcon *theIcon, HICON hIcon, COLORREF backgroundColor, int sizeX, int sizeY); +void DeleteCachedIcon(TLogIcon *theIcon); + +INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam); +INT_PTR SendMessageCommand_W(WPARAM wParam, LPARAM lParam); + +HIMAGELIST CreateStateImageList(); + +INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + +int TSAPI TBStateConvert2Flat(int state); +int TSAPI RBStateConvert2Flat(int state); +void TSAPI FillTabBackground(const HDC hdc, int iStateId, const TWindowData *dat, RECT* rc); #define IS_EXTKEY(a) (a & (1 << 24)) diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 1f709f1e46..1d0284ce35 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -31,6 +31,8 @@ void Chat_ModulesLoaded(); +bool g_bShutdown = false; + CGlobals PluginConfig; CGlobals* pConfig = &PluginConfig; @@ -518,6 +520,8 @@ int CGlobals::MetaContactEvent(WPARAM hContact, LPARAM lParam) int CGlobals::PreshutdownSendRecv(WPARAM wParam, LPARAM lParam) { + g_bShutdown = true; + ::TN_ModuleDeInit(); ::CloseAllContainers(); diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index d7d09555e3..b83f8ffeed 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -497,7 +497,6 @@ int LoadSendRecvMessageModule(void) LoadDefaultTemplates(); BuildCodePageList(); - return 0; } diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 1d62b934f3..ac9d41bfb4 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -1348,21 +1348,18 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara void TSAPI ReloadTabConfig() { - NONCLIENTMETRICS nclim; - int i=0; - PluginConfig.tabConfig.m_hPenLight = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT)); PluginConfig.tabConfig.m_hPenShadow = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW)); PluginConfig.tabConfig.m_hPenItemShadow = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW)); + NONCLIENTMETRICS nclim; nclim.cbSize = sizeof(nclim); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &nclim, 0); PluginConfig.tabConfig.m_hMenuFont = CreateFontIndirect(&nclim.lfMessageFont); - while (tabcolors[i].szKey != NULL) { + for (int i = 0; tabcolors[i].szKey != NULL; i++) PluginConfig.tabConfig.colors[i] = M.GetDword(CSkin::m_skinEnabled ? tabcolors[i].szSkinnedKey : tabcolors[i].szKey, GetSysColor(tabcolors[i].defclr)); - i++; - } + PluginConfig.tabConfig.m_brushes[0] = CreateSolidBrush(PluginConfig.tabConfig.colors[4]); PluginConfig.tabConfig.m_brushes[1] = CreateSolidBrush(PluginConfig.tabConfig.colors[5]); PluginConfig.tabConfig.m_brushes[2] = CreateSolidBrush(PluginConfig.tabConfig.colors[6]); diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 44243d5717..c6499fc3a7 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -1209,9 +1209,11 @@ void CSkin::Unload() ::DestroyIcon(*(m_skinIcons[i].phIcon)); mir_free(m_skinIcons); - M.getAeroState(); // refresh after unload - ::FreeTabConfig(); - ::ReloadTabConfig(); + if (!g_bShutdown) { + M.getAeroState(); // refresh after unload + ::FreeTabConfig(); + ::ReloadTabConfig(); + } m_bAvatarBorderType = AVBORDER_NORMAL; m_avatarBorderClr = ::GetSysColor(COLOR_3DDKSHADOW); diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h index ae51287a2e..513123a893 100644 --- a/plugins/TabSRMM/src/version.h +++ b/plugins/TabSRMM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3 #define __MINOR_VERSION 3 #define __RELEASE_NUM 1 -#define __BUILD_NUM 5 +#define __BUILD_NUM 6 #include -- cgit v1.2.3