The UK Kalender program was crashing when a new event was created as stated in the bug report. The fix is to create all the property sheet pages from the beginning instead of when they are selected.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54861
-- v6: comctl32/propsheet: Create pages with PSP_PREMATURE on initialization. comctl32/tests: Add test for propsheet page creation when propsheet gets initialized.
From: Jacob Czekalla jczekalla@codeweavers.com
--- dlls/comctl32/tests/propsheet.c | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c index 9bd1c08bd6a..fb89397f132 100644 --- a/dlls/comctl32/tests/propsheet.c +++ b/dlls/comctl32/tests/propsheet.c @@ -1388,6 +1388,49 @@ static void test_invalid_hpropsheetpage(void) DestroyWindow(hdlg); }
+static void test_init_page_creation(void) +{ + PROPSHEETPAGEA psp[3]; + PROPSHEETHEADERA psh; + HWND hp; + HWND page; + + memset(&psh, 0, sizeof(psh)); + memset(psp, 0, sizeof(psp)); + + for (int p = 0; p < 3; p++) + { + psp[p].dwSize = sizeof(PROPSHEETPAGEA); + psp[p].dwFlags = PSP_USETITLE | (p != 2 ? PSP_PREMATURE : 0); + psp[p].hInstance = GetModuleHandleA(NULL); + psp[p].pszTemplate = (const char *)MAKEINTRESOURCE(IDD_PROP_PAGE_EDIT); + psp[p].pszIcon = NULL; + psp[p].pfnDlgProc = (DLGPROC) page_dlg_proc; + psp[p].pszTitle = "page title"; + psp[p].lParam = 0; + } + + psh.dwSize = sizeof(PROPSHEETHEADERA); + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_MODELESS; + psh.hwndParent = GetDesktopWindow(); + psh.pszCaption = "test caption"; + psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGEA); + psh.ppsp = (LPCPROPSHEETPAGEA)&psp; + + hp = (HWND)pPropertySheetA(&psh); + + for (int p = 0; p < 3; p++) + { + page = (HWND)SendMessageA(hp, PSM_INDEXTOHWND, p, 0); + if(p == 2) + todo_wine ok(page == NULL, "Page %d created.\n", p); + else + todo_wine ok(page != NULL, "Page %d not created.\n", p); + } + + DestroyWindow(hp); +} + static void init_comctl32_functions(void) { HMODULE hComCtl32 = LoadLibraryA("comctl32.dll"); @@ -1442,6 +1485,7 @@ START_TEST(propsheet) test_CreatePropertySheetPage(); test_page_dialog_texture(); test_invalid_hpropsheetpage(); + test_init_page_creation();
if (!load_v6_module(&ctx_cookie, &ctx)) return;
From: Jacob Czekalla jczekalla@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54861 --- dlls/comctl32/propsheet.c | 8 ++++++++ dlls/comctl32/tests/propsheet.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index b530a1a8094..230c3218510 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -3625,6 +3625,14 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) psInfo->ppshheader.pszCaption); }
+ for (int index = 0; index < psInfo->nPages;) + { + DWORD premature = HPSP_get_flags(psInfo->proppage[index].hpage) & PSP_PREMATURE; + if (premature && !PROPSHEET_CreatePage(hwnd, index, psInfo, psInfo->proppage[index].hpage)) + PROPSHEET_RemovePage(hwnd, index, NULL); + else + index++; + }
if (psInfo->useCallback) (*(psInfo->ppshheader.pfnCallback))(hwnd, PSCB_INITIALIZED, 0); diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c index fb89397f132..00734b35db8 100644 --- a/dlls/comctl32/tests/propsheet.c +++ b/dlls/comctl32/tests/propsheet.c @@ -1423,9 +1423,9 @@ static void test_init_page_creation(void) { page = (HWND)SendMessageA(hp, PSM_INDEXTOHWND, p, 0); if(p == 2) - todo_wine ok(page == NULL, "Page %d created.\n", p); + ok(page == NULL, "Page %d created.\n", p); else - todo_wine ok(page != NULL, "Page %d not created.\n", p); + ok(page != NULL, "Page %d not created.\n", p); }
DestroyWindow(hp);
This merge request was approved by Zhiyi Zhang.