Fix crash in wxOSX when calling Disable() before Create()

This is explicitly allowed and we even have a unit test checking for
this, but the test crashed under macOS.

Fix this by simply doing nothing in wxWindow::DoEnable() if the window
is not created yet.
This commit is contained in:
Vadim Zeitlin
2021-09-03 00:38:30 +02:00
parent 0455e25302
commit f45fe496c0

View File

@@ -1269,6 +1269,11 @@ bool wxWindowMac::OSXShowWithEffect(bool show,
void wxWindowMac::DoEnable(bool enable)
{
// We can be called before the window is created in order to create it in
// the initially disabled state.
if ( !GetPeer() )
return;
GetPeer()->Enable( enable ) ;
MacInvalidateBorders();
}