comctl32/propsheet: Test and fix for crash processing PSM_INDEXTOHWND with no longer valid handle.
This commit is contained in:
parent
1aee359542
commit
a8f89a2ffa
@ -2553,6 +2553,8 @@ static LRESULT PROPSHEET_IndexToHwnd(HWND hwndDlg, int iPageIndex)
|
|||||||
{
|
{
|
||||||
PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
|
PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
|
||||||
TRACE("(%p, %d)\n", hwndDlg, iPageIndex);
|
TRACE("(%p, %d)\n", hwndDlg, iPageIndex);
|
||||||
|
if (!psInfo)
|
||||||
|
return 0;
|
||||||
if (iPageIndex<0 || iPageIndex>=psInfo->nPages) {
|
if (iPageIndex<0 || iPageIndex>=psInfo->nPages) {
|
||||||
WARN("%d out of range.\n", iPageIndex);
|
WARN("%d out of range.\n", iPageIndex);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
|
||||||
static HWND parent;
|
static HWND parent;
|
||||||
|
static HWND sheethwnd;
|
||||||
|
|
||||||
static LONG active_page = -1;
|
static LONG active_page = -1;
|
||||||
|
|
||||||
@ -40,12 +41,13 @@ static int CALLBACK sheet_callback(HWND hwnd, UINT msg, LPARAM lparam)
|
|||||||
char caption[256];
|
char caption[256];
|
||||||
GetWindowTextA(hwnd, caption, sizeof(caption));
|
GetWindowTextA(hwnd, caption, sizeof(caption));
|
||||||
ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
|
ok(!strcmp(caption,"test caption"), "caption: %s\n", caption);
|
||||||
|
sheethwnd = hwnd;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam,
|
static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam,
|
||||||
LPARAM lparam)
|
LPARAM lparam)
|
||||||
{
|
{
|
||||||
@ -71,6 +73,10 @@ static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case WM_NCDESTROY:
|
||||||
|
ok(!SendMessageA(sheethwnd, PSM_INDEXTOHWND, 400, 0),"Should always be 0\n");
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user