Ričardas Barkauskas : comctl32/propsheet: Test and fix for crash processing PSM_INDEXTOHWND with no longer valid handle .
Alexandre Julliard
julliard at winehq.org
Mon Oct 19 09:56:11 CDT 2009
Module: wine
Branch: master
Commit: a8f89a2ffa7065e59be39f0b5e32c1ece63cd340
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a8f89a2ffa7065e59be39f0b5e32c1ece63cd340
Author: Ričardas Barkauskas <miegalius at gmail.com>
Date: Sat Oct 17 19:11:29 2009 +0300
comctl32/propsheet: Test and fix for crash processing PSM_INDEXTOHWND with no longer valid handle.
---
dlls/comctl32/propsheet.c | 2 ++
dlls/comctl32/tests/propsheet.c | 8 +++++++-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c
index 4759d4c..5aef0e1 100644
--- a/dlls/comctl32/propsheet.c
+++ b/dlls/comctl32/propsheet.c
@@ -2553,6 +2553,8 @@ static LRESULT PROPSHEET_IndexToHwnd(HWND hwndDlg, int iPageIndex)
{
PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
TRACE("(%p, %d)\n", hwndDlg, iPageIndex);
+ if (!psInfo)
+ return 0;
if (iPageIndex<0 || iPageIndex>=psInfo->nPages) {
WARN("%d out of range.\n", iPageIndex);
return 0;
diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c
index 0eebe33..a61fa0b 100644
--- a/dlls/comctl32/tests/propsheet.c
+++ b/dlls/comctl32/tests/propsheet.c
@@ -26,6 +26,7 @@
#include "wine/test.h"
static HWND parent;
+static HWND sheethwnd;
static LONG active_page = -1;
@@ -40,12 +41,13 @@ static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
char caption[256];
GetWindowTextA(hwnd, caption, sizeof(caption));
ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
+ sheethwnd = hwnd;
return 0;
}
}
return 0;
}
-
+
static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam,
LPARAM lparam)
{
@@ -71,6 +73,10 @@ static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam,
return FALSE;
}
}
+ case WM_NCDESTROY:
+ ok(!SendMessageA(sheethwnd, PSM_INDEXTOHWND, 400, 0),"Should always be 0\n");
+ return TRUE;
+
default:
return FALSE;
}
More information about the wine-cvs
mailing list