Fix crash in wxStaticBox::HandleEraseBkgnd() in wxMSW on closing.
Don't process WM_ERASEBKGND if we're being destroyed. This is at best useful and at worst harmful as we currently crash in wxStaticBox::GetClientSize() if there is no valid TLW parent. Closes #14355. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -4843,6 +4843,16 @@ void wxWindowMSW::OnPaint(wxPaintEvent& event)
|
||||
|
||||
bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
|
||||
{
|
||||
if ( IsBeingDeleted() )
|
||||
{
|
||||
// We can get WM_ERASEBKGND after starting the destruction of our top
|
||||
// level parent. Handling it in this case is unnecessary and can be
|
||||
// actually harmful as e.g. wxStaticBox::GetClientSize() doesn't work
|
||||
// without a valid TLW parent (because it uses dialog units internally
|
||||
// which use the dialog font), so just don't do anything then.
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ( GetBackgroundStyle() )
|
||||
{
|
||||
case wxBG_STYLE_ERASE:
|
||||
|
Reference in New Issue
Block a user