summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-08-21 12:13:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-08-21 12:13:17 +0000
commitcdc121346620d6509a0b8c6483d7f228c6e89861 (patch)
treee90ebc8855cc427f7374f2c5e47d6b3eab996e5b /plugins/TabSRMM/src
parent69f1b22444007e84cb50768fcddb2123c93f623a (diff)
tabSRMM: thy shall not create a container after shutdown
git-svn-id: http://svn.miranda-ng.org/main/trunk@5771 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/chat/services.cpp6
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp3
-rw-r--r--plugins/TabSRMM/src/container.cpp3
-rw-r--r--plugins/TabSRMM/src/mim.cpp18
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp3
-rw-r--r--plugins/TabSRMM/src/msgs.cpp13
6 files changed, 26 insertions, 20 deletions
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp
index e346526e08..60ca0f1ea4 100644
--- a/plugins/TabSRMM/src/chat/services.cpp
+++ b/plugins/TabSRMM/src/chat/services.cpp
@@ -418,7 +418,8 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT
TCHAR szName[CONTAINER_NAMELEN + 1];
mir_sntprintf(szName, CONTAINER_NAMELEN, _T("default"));
- pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact);
+ if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact)) == NULL)
+ return 0;
}
}
@@ -565,7 +566,8 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground)
}
if (pContainer == NULL)
pContainer = CreateContainer(szName, FALSE, si->hContact);
- si->hWnd = CreateNewRoom(pContainer, si, TRUE, TRUE, FALSE);
+ if (pContainer)
+ si->hWnd = CreateNewRoom(pContainer, si, TRUE, TRUE, FALSE);
}
INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 7ba1c799db..01dac55bef 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -3361,7 +3361,8 @@ LABEL_SHOWWINDOW:
break;
pNewContainer = FindContainerByName(szNewName);
if (pNewContainer == NULL)
- pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact);
+ if ((pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact)) == NULL)
+ break;
db_set_ts(dat->hContact, SRMSGMOD_T, "containerW", szNewName);
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB_CHAT, (WPARAM)pNewContainer, (LPARAM)hwndDlg);
if (iOldItems > 1) // there were more than 1 tab, container is still valid
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index f2bdb639d3..f4ffd09007 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -136,6 +136,9 @@ void TSAPI SetAeroMargins(TContainerData *pContainer)
TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDLE hContactFrom)
{
+ if (CMimAPI::m_shutDown)
+ return NULL;
+
char *szKey = "TAB_ContainersW";
int iFirstFree = -1, iFound = FALSE;
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp
index cdec5bdf9b..3bb7a98cb7 100644
--- a/plugins/TabSRMM/src/mim.cpp
+++ b/plugins/TabSRMM/src/mim.cpp
@@ -699,7 +699,8 @@ int CMimAPI::MessageEventAdded(WPARAM wParam, LPARAM lParam)
TContainerData *pContainer = FindContainerByName(szName);
if (pContainer == NULL)
pContainer = CreateContainer(szName, FALSE, hContact);
- CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, FALSE, 0);
+ if (pContainer)
+ CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, FALSE, 0);
return 0;
}
@@ -714,22 +715,17 @@ int CMimAPI::MessageEventAdded(WPARAM wParam, LPARAM lParam)
CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent);
return 0;
}
- if (bAutoContainer) {
- pContainer = CreateContainer(szName, CNT_CREATEFLAG_MINIMIZED, hContact); // 2 means create minimized, don't popup...
- CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent);
- SendMessageW(pContainer->hwnd, WM_SIZE, 0, 0);
- return 0;
- }
}
else {
CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent);
return 0;
}
}
- else if (bAutoContainer) {
- pContainer = CreateContainer(szName, CNT_CREATEFLAG_MINIMIZED, hContact); // 2 means create minimized, don't popup...
- CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent);
- SendMessageW(pContainer->hwnd, WM_SIZE, 0, 0);
+ if (bAutoContainer) {
+ if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_MINIMIZED, hContact)) != NULL) { // 2 means create minimized, don't popup...
+ CreateNewTabForContact(pContainer, hContact, 0, NULL, bActivate, bPopup, TRUE, hDbEvent);
+ SendMessageW(pContainer->hwnd, WM_SIZE, 0, 0);
+ }
return 0;
}
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 66495b2662..87f3170f4c 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -3271,7 +3271,8 @@ quote_from_last:
TContainerData *pNewContainer = FindContainerByName(szNewName);
if (pNewContainer == NULL)
- pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact);
+ if ((pNewContainer = CreateContainer(szNewName, FALSE, dat->hContact)) == NULL)
+ break;
db_set_ts(dat->hContact, SRMSGMOD_T, "containerW", szNewName);
dat->fIsReattach = TRUE;
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_DOCREATETAB, (WPARAM)pNewContainer, (LPARAM)dat->hContact);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 667b274001..de0e3fc24e 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -291,7 +291,8 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam)
TContainerData *pContainer = FindContainerByName(szName);
if (pContainer == NULL)
pContainer = CreateContainer(szName, FALSE, hContact);
- CreateNewTabForContact(pContainer, hContact, 0, NULL, TRUE, TRUE, FALSE, 0);
+ if (pContainer)
+ CreateNewTabForContact(pContainer, hContact, 0, NULL, TRUE, TRUE, FALSE, 0);
}
return 0;
}
@@ -348,7 +349,8 @@ INT_PTR SendMessageCommand_W(WPARAM wParam, LPARAM lParam)
TContainerData *pContainer = FindContainerByName(szName);
if (pContainer == NULL)
pContainer = CreateContainer(szName, FALSE, hContact);
- CreateNewTabForContact(pContainer, hContact, 1, (const char *)lParam, TRUE, TRUE, FALSE, 0);
+ if (pContainer)
+ CreateNewTabForContact(pContainer, hContact, 1, (const char *)lParam, TRUE, TRUE, FALSE, 0);
}
return 0;
}
@@ -402,7 +404,8 @@ INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam)
TContainerData *pContainer = FindContainerByName(szName);
if (pContainer == NULL)
pContainer = CreateContainer(szName, FALSE, hContact);
- CreateNewTabForContact(pContainer, hContact, 0, (const char *) lParam, TRUE, TRUE, FALSE, 0);
+ if (pContainer)
+ CreateNewTabForContact(pContainer, hContact, 0, (const char *) lParam, TRUE, TRUE, FALSE, 0);
}
return 0;
}
@@ -685,9 +688,9 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, HANDLE hContact, i
if (hContact != 0 && M.GetByte("limittabs", 0) && !_tcsncmp(pContainer->szName, _T("default"), 6)) {
if ((pContainer = FindMatchingContainer(_T("default"), hContact)) == NULL) {
TCHAR szName[CONTAINER_NAMELEN + 1];
-
mir_sntprintf(szName, CONTAINER_NAMELEN, _T("default"));
- pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact);
+ if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact)) == NULL)
+ return 0;
}
}