Don't try creating the gripper before wxDialog is created

Don't do anything in wxDialog::SetWindowStyleFlag() if it's called
before the dialog is actually created, as it happened during wxDirDialog
initialization.

Gripper creation failed anyhow in this case and this also resulted in a
debug message from wxMSWDarkMode::AllowForWindow() as we passed it an
invalid HWND.
This commit is contained in:
Vadim Zeitlin 2022-12-25 19:38:38 +00:00
parent 32daebe883
commit ca5cd2f18d

View file

@ -211,6 +211,10 @@ void wxDialog::SetWindowStyleFlag(long style)
{
wxDialogBase::SetWindowStyleFlag(style);
// Don't do anything if we're setting the style before creating the dialog.
if ( !GetHwnd() )
return;
if ( HasFlag(wxRESIZE_BORDER) )
CreateGripper();
else