Properties: clear text ctrl from unit binder before it is destroyed
The lifetime of this text ctrl is managed by the property grid, so we need to catch when it is hidden before destruction in order to avoid stale pointers being used to handle unit change events. Credit to @dsa-t for the fix
This commit is contained in:
parent
77b763f8ba
commit
d0024bd9f7
|
@ -642,5 +642,13 @@ void PROPERTY_EDITOR_UNIT_BINDER::SetControl( wxWindow* aControl )
|
|||
nullptr, this );
|
||||
m_valueCtrl->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( PROPERTY_EDITOR_UNIT_BINDER::onClick ),
|
||||
nullptr, this );
|
||||
m_valueCtrl->Bind( wxEVT_SET_FOCUS, &PROPERTY_EDITOR_UNIT_BINDER::onSetFocus, this );
|
||||
|
||||
m_valueCtrl->Bind( wxEVT_SHOW,
|
||||
[&]( wxShowEvent& e )
|
||||
{
|
||||
if( !e.IsShown() )
|
||||
SetControl( nullptr );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue