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:
Vadim Zeitlin
2014-02-20 00:31:42 +00:00
parent 4c711c8002
commit aaa52a40ee

View File

@@ -171,6 +171,9 @@ wxFileDialogHookFunction(HWND hDlg,
#endif // __WXWINCE__ #endif // __WXWINCE__
case WM_NOTIFY: case WM_NOTIFY:
{
NMHDR* const pNM = reinterpret_cast<NMHDR*>(lParam);
if ( pNM->code >= CDN_FIRST && pNM->code < CDN_LAST )
{ {
OFNOTIFY* const OFNOTIFY* const
pNotifyCode = reinterpret_cast<OFNOTIFY *>(lParam); pNotifyCode = reinterpret_cast<OFNOTIFY *>(lParam);
@@ -190,6 +193,7 @@ wxFileDialogHookFunction(HWND hDlg,
break; break;
} }
} }
}
break; break;
case WM_DESTROY: case WM_DESTROY: