Add m_isClosing guard in an attempt to prevent KICAD-1XF.
This commit is contained in:
parent
341124d831
commit
0de966f9ce
|
@ -81,6 +81,7 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl
|
||||||
m_useCalculatedSize( false ),
|
m_useCalculatedSize( false ),
|
||||||
m_firstPaintEvent( true ),
|
m_firstPaintEvent( true ),
|
||||||
m_initialFocusTarget( nullptr ),
|
m_initialFocusTarget( nullptr ),
|
||||||
|
m_isClosing( false ),
|
||||||
m_qmodal_loop( nullptr ),
|
m_qmodal_loop( nullptr ),
|
||||||
m_qmodal_showing( false ),
|
m_qmodal_showing( false ),
|
||||||
m_qmodal_parent_disabler( nullptr ),
|
m_qmodal_parent_disabler( nullptr ),
|
||||||
|
@ -140,6 +141,8 @@ DIALOG_SHIM::DIALOG_SHIM( wxWindow* aParent, wxWindowID id, const wxString& titl
|
||||||
|
|
||||||
DIALOG_SHIM::~DIALOG_SHIM()
|
DIALOG_SHIM::~DIALOG_SHIM()
|
||||||
{
|
{
|
||||||
|
m_isClosing = true;
|
||||||
|
|
||||||
Unbind( wxEVT_CLOSE_WINDOW, &DIALOG_SHIM::OnCloseWindow, this );
|
Unbind( wxEVT_CLOSE_WINDOW, &DIALOG_SHIM::OnCloseWindow, this );
|
||||||
Unbind( wxEVT_BUTTON, &DIALOG_SHIM::OnButton, this );
|
Unbind( wxEVT_BUTTON, &DIALOG_SHIM::OnButton, this );
|
||||||
Unbind( wxEVT_PAINT, &DIALOG_SHIM::OnPaint, this );
|
Unbind( wxEVT_PAINT, &DIALOG_SHIM::OnPaint, this );
|
||||||
|
@ -151,14 +154,14 @@ DIALOG_SHIM::~DIALOG_SHIM()
|
||||||
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( child ) )
|
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( child ) )
|
||||||
{
|
{
|
||||||
textCtrl->Disconnect( wxEVT_SET_FOCUS,
|
textCtrl->Disconnect( wxEVT_SET_FOCUS,
|
||||||
wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ), nullptr,
|
wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
|
||||||
this );
|
nullptr, this );
|
||||||
}
|
}
|
||||||
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( child ) )
|
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( child ) )
|
||||||
{
|
{
|
||||||
scintilla->Disconnect( wxEVT_SET_FOCUS,
|
scintilla->Disconnect( wxEVT_SET_FOCUS,
|
||||||
wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ), nullptr,
|
wxFocusEventHandler( DIALOG_SHIM::onChildSetFocus ),
|
||||||
this );
|
nullptr, this );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -618,10 +621,13 @@ void DIALOG_SHIM::onChildSetFocus( wxFocusEvent& aEvent )
|
||||||
{
|
{
|
||||||
// When setting focus to a text control reset the before-edit value.
|
// When setting focus to a text control reset the before-edit value.
|
||||||
|
|
||||||
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( aEvent.GetEventObject() ) )
|
if( !m_isClosing )
|
||||||
m_beforeEditValues[ textCtrl ] = textCtrl->GetValue();
|
{
|
||||||
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( aEvent.GetEventObject() ) )
|
if( wxTextCtrl* textCtrl = dynamic_cast<wxTextCtrl*>( aEvent.GetEventObject() ) )
|
||||||
m_beforeEditValues[ scintilla ] = scintilla->GetText();
|
m_beforeEditValues[ textCtrl ] = textCtrl->GetValue();
|
||||||
|
else if( wxStyledTextCtrl* scintilla = dynamic_cast<wxStyledTextCtrl*>( aEvent.GetEventObject() ) )
|
||||||
|
m_beforeEditValues[ scintilla ] = scintilla->GetText();
|
||||||
|
}
|
||||||
|
|
||||||
aEvent.Skip();
|
aEvent.Skip();
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,6 +213,7 @@ protected:
|
||||||
// the initial-focus SetFocus() call to the first paint event.
|
// the initial-focus SetFocus() call to the first paint event.
|
||||||
bool m_firstPaintEvent;
|
bool m_firstPaintEvent;
|
||||||
wxWindow* m_initialFocusTarget;
|
wxWindow* m_initialFocusTarget;
|
||||||
|
bool m_isClosing;
|
||||||
|
|
||||||
WX_EVENT_LOOP* m_qmodal_loop; // points to nested event_loop, NULL means not qmodal
|
WX_EVENT_LOOP* m_qmodal_loop; // points to nested event_loop, NULL means not qmodal
|
||||||
// and dismissed
|
// and dismissed
|
||||||
|
|
Loading…
Reference in New Issue