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/branches/WX_3_0_BRANCH@75937 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -172,22 +172,26 @@ wxFileDialogHookFunction(HWND hDlg,
|
|||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
OFNOTIFY* const
|
NMHDR* const pNM = reinterpret_cast<NMHDR*>(lParam);
|
||||||
pNotifyCode = reinterpret_cast<OFNOTIFY *>(lParam);
|
if ( pNM->code >= CDN_FIRST && pNM->code < CDN_LAST )
|
||||||
wxFileDialog* const
|
|
||||||
dialog = reinterpret_cast<wxFileDialog *>(
|
|
||||||
pNotifyCode->lpOFN->lCustData
|
|
||||||
);
|
|
||||||
|
|
||||||
switch ( pNotifyCode->hdr.code )
|
|
||||||
{
|
{
|
||||||
case CDN_INITDONE:
|
OFNOTIFY* const
|
||||||
dialog->MSWOnInitDone((WXHWND)hDlg);
|
pNotifyCode = reinterpret_cast<OFNOTIFY *>(lParam);
|
||||||
break;
|
wxFileDialog* const
|
||||||
|
dialog = reinterpret_cast<wxFileDialog *>(
|
||||||
|
pNotifyCode->lpOFN->lCustData
|
||||||
|
);
|
||||||
|
|
||||||
case CDN_SELCHANGE:
|
switch ( pNotifyCode->hdr.code )
|
||||||
dialog->MSWOnSelChange((WXHWND)hDlg);
|
{
|
||||||
break;
|
case CDN_INITDONE:
|
||||||
|
dialog->MSWOnInitDone((WXHWND)hDlg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CDN_SELCHANGE:
|
||||||
|
dialog->MSWOnSelChange((WXHWND)hDlg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user