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:
@@ -1269,6 +1269,11 @@ bool wxWindowMac::OSXShowWithEffect(bool show,
|
|||||||
|
|
||||||
void wxWindowMac::DoEnable(bool enable)
|
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 ) ;
|
GetPeer()->Enable( enable ) ;
|
||||||
MacInvalidateBorders();
|
MacInvalidateBorders();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user