Unset active page while setting a new active page for a propsheet

Aric Stewart aric at codeweavers.com
Fri Mar 30 11:35:12 CDT 2007


Before calling the PSN_SETACTIVE in PROPSHEET_SetCurSel set the 
active_page to -1. This prevents crashes and corruption of the property 
sheet if the application makes any modifications during the PSN_SETACTIVE.
MSDN explicitly states that an application should NOT make such 
modifications (such as removing a page).
However i have found a few installers that do just that. And the work on 
windows but cause wine to crash.
the PROPSHEET_SetCurSel code always calls a ShowPage at the end so there 
will not be a case where the active_page becomes invalid while outside 
of this handling.

---
  dlls/comctl32/propsheet.c |    5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)
-------------- next part --------------
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c
index 06ce339..a0e7027 100644
--- a/dlls/comctl32/propsheet.c
+++ b/dlls/comctl32/propsheet.c
@@ -2023,6 +2023,11 @@ static BOOL PROPSHEET_SetCurSel(HWND hwn
     return FALSE;
   }
 
+  /* unset active page while doing this transition. */
+  if (psInfo->active_page != -1)
+     ShowWindow(psInfo->proppage[psInfo->active_page].hwndPage, SW_HIDE);
+  psInfo->active_page = -1;  
+
   while (1) {
     int result;
     PSHNOTIFY psn;


More information about the wine-patches mailing list