Don't use invalid pointer in file dialog hook procedure in wxMSW.
We can receive WM_NOTIFY for other than CDN_XXX messages if we have a native control as our immediate child (which can happen with "extra" controls) and the LPARAM is not a pointer to OFNOTIFY at all in this case, so don't try to use it as such. This fixes a crash when adding a "bare" extra control, see #16003. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
81b62354dc
commit
ac7e40cde2
@ -172,22 +172,26 @@ wxFileDialogHookFunction(HWND hDlg,
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
OFNOTIFY* const
|
||||
pNotifyCode = reinterpret_cast<OFNOTIFY *>(lParam);
|
||||
wxFileDialog* const
|
||||
dialog = reinterpret_cast<wxFileDialog *>(
|
||||
pNotifyCode->lpOFN->lCustData
|
||||
);
|
||||
|
||||
switch ( pNotifyCode->hdr.code )
|
||||
NMHDR* const pNM = reinterpret_cast<NMHDR*>(lParam);
|
||||
if ( pNM->code >= CDN_FIRST && pNM->code < CDN_LAST )
|
||||
{
|
||||
case CDN_INITDONE:
|
||||
dialog->MSWOnInitDone((WXHWND)hDlg);
|
||||
break;
|
||||
OFNOTIFY* const
|
||||
pNotifyCode = reinterpret_cast<OFNOTIFY *>(lParam);
|
||||
wxFileDialog* const
|
||||
dialog = reinterpret_cast<wxFileDialog *>(
|
||||
pNotifyCode->lpOFN->lCustData
|
||||
);
|
||||
|
||||
case CDN_SELCHANGE:
|
||||
dialog->MSWOnSelChange((WXHWND)hDlg);
|
||||
break;
|
||||
switch ( pNotifyCode->hdr.code )
|
||||
{
|
||||
case CDN_INITDONE:
|
||||
dialog->MSWOnInitDone((WXHWND)hDlg);
|
||||
break;
|
||||
|
||||
case CDN_SELCHANGE:
|
||||
dialog->MSWOnSelChange((WXHWND)hDlg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user