summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-19 10:50:55 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-19 10:50:55 +0000
commit18f47c388bfc624918358517246d1756ed340ef3 (patch)
tree638d07017405781c1989ab54b8fd416e0abcb8bf /plugins
parenta7eaae2cf935a1b4037d57d912f683d40bd65fc5 (diff)
fix for deadlock on messages in tabSRMM
git-svn-id: http://svn.miranda-ng.org/main/trunk@7749 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/TabSRMM/src/container.cpp16
-rw-r--r--plugins/TabSRMM/src/functions.h1
-rw-r--r--plugins/TabSRMM/src/globals.cpp7
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp17
-rw-r--r--plugins/TabSRMM/src/themes.cpp4
5 files changed, 23 insertions, 22 deletions
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 1b10afe812..9c3e27b556 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -2473,3 +2473,19 @@ void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WP
}
}
}
+
+void TSAPI CloseAllContainers()
+{
+ BOOL fOldHideSetting = PluginConfig.m_HideOnClose;
+
+ while (pFirstContainer != NULL) {
+ if (!IsWindow(pFirstContainer->hwnd))
+ pFirstContainer = pFirstContainer->pNext;
+ else {
+ PluginConfig.m_HideOnClose = FALSE;
+ ::SendMessage(pFirstContainer->hwnd, WM_CLOSE, 0, 1);
+ }
+ }
+
+ PluginConfig.m_HideOnClose = fOldHideSetting;
+}
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h
index a7369efe7e..c090228b07 100644
--- a/plugins/TabSRMM/src/functions.h
+++ b/plugins/TabSRMM/src/functions.h
@@ -97,6 +97,7 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg);
TContainerData* TSAPI AppendToContainerList(TContainerData *pContainer);
TContainerData* TSAPI RemoveContainerFromList(TContainerData *pContainer);
+void TSAPI CloseAllContainers();
void TSAPI DeleteContainer(int iIndex);
void TSAPI RenameContainer(int iIndex, const TCHAR *newName);
int TSAPI GetContainerNameForContact(HANDLE hContact, TCHAR *szName, int iNameLen);
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index e10b9d2253..a2bf75563f 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -540,12 +540,7 @@ int CGlobals::MetaContactEvent(WPARAM wParam, LPARAM lParam)
int CGlobals::PreshutdownSendRecv(WPARAM wParam, LPARAM lParam)
{
::TN_ModuleDeInit();
-
- while(pFirstContainer){
- if (PluginConfig.m_HideOnClose)
- PluginConfig.m_HideOnClose = FALSE;
- ::SendMessage(pFirstContainer->hwnd, WM_CLOSE, 0, 1);
- }
+ ::CloseAllContainers();
for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
db_set_dw(hContact, SRMSGMOD_T, "messagecount", 0);
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 2e97d7a33f..b136c44603 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -354,18 +354,10 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://wiki.miranda.or.at/TabSRMM/UsingSkins");
break;
- case IDC_SKIN_CLOSENOW: {
- BOOL fOldHideSetting = PluginConfig.m_HideOnClose;
-
- PluginConfig.m_HideOnClose = FALSE;
-
- while(pFirstContainer)
- if (pFirstContainer->hwnd)
- SendMessage(pFirstContainer->hwnd, WM_CLOSE, 0, 1);
-
- PluginConfig.m_HideOnClose = fOldHideSetting;
+ case IDC_SKIN_CLOSENOW:
+ CloseAllContainers();
break;
- }
+
case IDC_SKINNAME: {
if (HIWORD(wParam) == CBN_SELCHANGE) {
LRESULT lr = SendDlgItemMessage(hwndDlg, IDC_SKINNAME, CB_GETCURSEL, 0 ,0);
@@ -385,8 +377,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
break;
}
}
- if ((LOWORD(wParam) == IDC_SKINNAME)
- && (HIWORD(wParam) != CBN_SELCHANGE || (HWND) lParam != GetFocus()))
+ if ((LOWORD(wParam) == IDC_SKINNAME) && (HIWORD(wParam) != CBN_SELCHANGE || (HWND) lParam != GetFocus()))
return 0;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index f0486c071b..04fda1e79e 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -1088,9 +1088,7 @@ bool CSkin::warnToClose() const
TranslateT("Change skin"), MB_YESNO | MB_ICONQUESTION) != IDYES)
return false;
- TContainerData *pContainer = ::pFirstContainer;
- while (pFirstContainer)
- SendMessage(pFirstContainer->hwnd, WM_CLOSE, 0, 1);
+ CloseAllContainers();
return true;
}