Remove disconnects from SetControl

These aren't needed as the control is going to be destroyed by the grid,
and can cause a crash on exit if the control is destroyed before the unit binder.
This commit is contained in:
Jon Evans 2022-12-06 08:06:16 -05:00
parent 74fa88c0f6
commit 40f9a59255
1 changed files with 3 additions and 16 deletions

View File

@ -622,26 +622,13 @@ PROPERTY_EDITOR_UNIT_BINDER::~PROPERTY_EDITOR_UNIT_BINDER()
void PROPERTY_EDITOR_UNIT_BINDER::SetControl( wxWindow* aControl )
{
if( m_valueCtrl )
{
m_valueCtrl->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( PROPERTY_EDITOR_UNIT_BINDER::onSetFocus ),
nullptr, this );
m_valueCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( PROPERTY_EDITOR_UNIT_BINDER::onKillFocus ),
nullptr, this );
m_valueCtrl->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( PROPERTY_EDITOR_UNIT_BINDER::onClick ),
nullptr, this );
}
m_valueCtrl = aControl;
if( m_valueCtrl )
{
m_valueCtrl->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( PROPERTY_EDITOR_UNIT_BINDER::onSetFocus ),
nullptr, this );
m_valueCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( PROPERTY_EDITOR_UNIT_BINDER::onKillFocus ),
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_KILL_FOCUS, &PROPERTY_EDITOR_UNIT_BINDER::onKillFocus, this );
m_valueCtrl->Bind( wxEVT_LEFT_UP, &PROPERTY_EDITOR_UNIT_BINDER::onClick, this );
m_valueCtrl->Bind( wxEVT_SHOW,
[&]( wxShowEvent& e )