summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-10 17:50:05 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-10 17:50:05 +0000
commitfb2153343180082ffb144eb2585e20bcf25351eb (patch)
tree1a4afcac6cb3b76ebe5b9afe97b316f7a0a49bc0
parentfc64dc4c81080c920eacdfb2fc23b24a7fef2f02 (diff)
crash fix for wrongly defined option pages
git-svn-id: http://svn.miranda-ng.org/main/trunk@13511 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--bin10/lib/mir_core.libbin328092 -> 328092 bytes
-rw-r--r--bin10/lib/mir_core64.libbin329832 -> 329832 bytes
-rw-r--r--bin12/lib/mir_core.libbin328092 -> 328092 bytes
-rw-r--r--bin12/lib/mir_core64.libbin329832 -> 329832 bytes
-rw-r--r--src/core/commonheaders.h1
-rw-r--r--src/modules/options/options.cpp18
6 files changed, 15 insertions, 4 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index 275457a9b1..846cc7134b 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index 4835a15441..e80a43e6a1 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib
index 47d466f9b7..e4a5ed79b7 100644
--- a/bin12/lib/mir_core.lib
+++ b/bin12/lib/mir_core.lib
Binary files differ
diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib
index 2f5ab51c4c..5b1afcdd93 100644
--- a/bin12/lib/mir_core64.lib
+++ b/bin12/lib/mir_core64.lib
Binary files differ
diff --git a/src/core/commonheaders.h b/src/core/commonheaders.h
index 6d5de6ecba..3c60da9b96 100644
--- a/src/core/commonheaders.h
+++ b/src/core/commonheaders.h
@@ -42,6 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <crtdbg.h>
#endif
+#include <assert.h>
#include <malloc.h>
#include <stdio.h>
#include <math.h>
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp
index f9a79eaec9..f56d396fec 100644
--- a/src/modules/options/options.cpp
+++ b/src/modules/options/options.cpp
@@ -86,6 +86,7 @@ struct OptionsPageData : public MZeroedObject
pDialog = new COptionPageDialog(src->hInstance, (int)src->pszTemplate, src->pfnDlgProc, src->dwInitParam);
else
pDialog = src->pDialog;
+ assert(pDialog != NULL);
flags = src->flags;
hLangpack = src->hLangpack;
@@ -108,7 +109,7 @@ struct OptionsPageData : public MZeroedObject
~OptionsPageData()
{
- if (getHwnd() != NULL)
+ if (pDialog && getHwnd() != NULL)
DestroyWindow(getHwnd());
}
@@ -712,8 +713,13 @@ static void LoadOptionsModule(HWND hdlg, OptionsDlgData *dat, HINSTANCE hInst)
if (opi.pageCount == 0)
return;
- for (int i = 0; i < opi.pageCount; i++)
- dat->arOpd.insert(new OptionsPageData(&opi.odp[i]));
+ for (int i = 0; i < opi.pageCount; i++) {
+ OptionsPageData *opd = new OptionsPageData(&opi.odp[i]);
+ if (opd->pDialog == NULL) // smth went wrong
+ delete opd;
+ else
+ dat->arOpd.insert(opd);
+ }
FreeOptionsData(&opi);
PostMessage(hdlg, DM_REBUILDPAGETREE, 0, 0);
@@ -814,7 +820,11 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L
OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)psh->ppsp;
for (UINT i = 0; i < psh->nPages; i++, odp++) {
- dat->arOpd.insert(new OptionsPageData(odp));
+ OptionsPageData *opd = new OptionsPageData(odp);
+ if (opd->pDialog == NULL) // smth went wrong
+ delete opd;
+ else
+ dat->arOpd.insert(opd);
if (!mir_tstrcmp(lastPage, odp->ptszTitle) && !mir_tstrcmp(lastGroup, odp->ptszGroup))
if ((ood->pszTab == NULL && dat->currentPage == -1) || !mir_tstrcmp(lastTab, odp->ptszTab))