Don't pass a FRAME-based UNITS_PROVIDER to a modeless dialog.
(The dialog may outlive said frame.)
Should fix Sentry KICAD-3A.
(cherry picked from commit 9b4627e782
)
This commit is contained in:
parent
927b5ae707
commit
a21e7a5eee
|
@ -46,7 +46,6 @@ UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent, wxStaticText* aLabel, wxWindo
|
||||||
UNIT_BINDER::UNIT_BINDER( UNITS_PROVIDER* aUnitsProvider, wxWindow* aEventSource,
|
UNIT_BINDER::UNIT_BINDER( UNITS_PROVIDER* aUnitsProvider, wxWindow* aEventSource,
|
||||||
wxStaticText* aLabel, wxWindow* aValueCtrl, wxStaticText* aUnitLabel,
|
wxStaticText* aLabel, wxWindow* aValueCtrl, wxStaticText* aUnitLabel,
|
||||||
bool aAllowEval, bool aBindFocusEvent ) :
|
bool aAllowEval, bool aBindFocusEvent ) :
|
||||||
m_eventSource( aEventSource ),
|
|
||||||
m_bindFocusEvent( aBindFocusEvent ),
|
m_bindFocusEvent( aBindFocusEvent ),
|
||||||
m_label( aLabel ),
|
m_label( aLabel ),
|
||||||
m_valueCtrl( aValueCtrl ),
|
m_valueCtrl( aValueCtrl ),
|
||||||
|
@ -99,10 +98,10 @@ UNIT_BINDER::UNIT_BINDER( UNITS_PROVIDER* aUnitsProvider, wxWindow* aEventSource
|
||||||
this );
|
this );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_eventSource )
|
if( aEventSource )
|
||||||
{
|
{
|
||||||
m_eventSource->Connect( UNITS_CHANGED, wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ),
|
aEventSource->Connect( UNITS_CHANGED, wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ),
|
||||||
nullptr, this );
|
nullptr, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,12 +114,6 @@ UNIT_BINDER::~UNIT_BINDER()
|
||||||
this );
|
this );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_eventSource )
|
|
||||||
{
|
|
||||||
m_eventSource->Disconnect( UNITS_CHANGED, wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ),
|
|
||||||
nullptr, this );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_valueCtrl )
|
if( m_valueCtrl )
|
||||||
{
|
{
|
||||||
m_valueCtrl->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( UNIT_BINDER::onSetFocus ),
|
m_valueCtrl->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( UNIT_BINDER::onSetFocus ),
|
||||||
|
@ -395,7 +388,7 @@ void UNIT_BINDER::SetValue( const wxString& aValue )
|
||||||
|
|
||||||
value += EDA_UNIT_UTILS::GetLabel( m_units, m_dataType );
|
value += EDA_UNIT_UTILS::GetLabel( m_units, m_dataType );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( textEntry )
|
if( textEntry )
|
||||||
textEntry->SetValue( value );
|
textEntry->SetValue( value );
|
||||||
else if( staticText )
|
else if( staticText )
|
||||||
|
|
|
@ -140,7 +140,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
||||||
void OnKifaceEnd() override;
|
void OnKifaceEnd() override;
|
||||||
|
|
||||||
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
|
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
|
||||||
int aCtlBits = 0 ) override
|
int aCtlBits = 0 ) override
|
||||||
{
|
{
|
||||||
switch( aClassId )
|
switch( aClassId )
|
||||||
{
|
{
|
||||||
|
@ -204,9 +204,9 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
||||||
frame = aKiway->Player( FRAME_SCH, false );
|
frame = aKiway->Player( FRAME_SCH, false );
|
||||||
|
|
||||||
if( frame )
|
if( frame )
|
||||||
return new PANEL_SYM_EDITING_OPTIONS( aParent, frame, frame );
|
SetUserUnits( frame->GetUserUnits() );
|
||||||
else
|
|
||||||
return new PANEL_SYM_EDITING_OPTIONS( aParent, this, nullptr );
|
return new PANEL_SYM_EDITING_OPTIONS( aParent, this, frame );
|
||||||
}
|
}
|
||||||
|
|
||||||
case PANEL_SYM_COLORS:
|
case PANEL_SYM_COLORS:
|
||||||
|
@ -231,9 +231,9 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
||||||
frame = aKiway->Player( FRAME_SCH_VIEWER, false );
|
frame = aKiway->Player( FRAME_SCH_VIEWER, false );
|
||||||
|
|
||||||
if( frame )
|
if( frame )
|
||||||
return new PANEL_EESCHEMA_EDITING_OPTIONS( aParent, frame, frame );
|
SetUserUnits( frame->GetUserUnits() );
|
||||||
else
|
|
||||||
return new PANEL_EESCHEMA_EDITING_OPTIONS( aParent, this, nullptr );
|
return new PANEL_EESCHEMA_EDITING_OPTIONS( aParent, this, frame );
|
||||||
}
|
}
|
||||||
|
|
||||||
case PANEL_SCH_ANNO_OPTIONS:
|
case PANEL_SCH_ANNO_OPTIONS:
|
||||||
|
|
|
@ -221,7 +221,6 @@ protected:
|
||||||
double setPrecision( double aValue, bool aValueUsesUserUnits );
|
double setPrecision( double aValue, bool aValueUsesUserUnits );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxWindow* m_eventSource;
|
|
||||||
bool m_bindFocusEvent;
|
bool m_bindFocusEvent;
|
||||||
|
|
||||||
///< The bound widgets
|
///< The bound widgets
|
||||||
|
|
|
@ -86,7 +86,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
||||||
void OnKifaceEnd() override;
|
void OnKifaceEnd() override;
|
||||||
|
|
||||||
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
|
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
|
||||||
int aCtlBits = 0 ) override
|
int aCtlBits = 0 ) override
|
||||||
{
|
{
|
||||||
switch( aClassId )
|
switch( aClassId )
|
||||||
{
|
{
|
||||||
|
@ -160,9 +160,9 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
||||||
frame = aKiway->Player( FRAME_PCB_EDITOR, false );
|
frame = aKiway->Player( FRAME_PCB_EDITOR, false );
|
||||||
|
|
||||||
if( frame )
|
if( frame )
|
||||||
return new PANEL_EDIT_OPTIONS( aParent, frame, frame, true );
|
SetUserUnits( frame->GetUserUnits() );
|
||||||
else
|
|
||||||
return new PANEL_EDIT_OPTIONS( aParent, this, nullptr, true );
|
return new PANEL_EDIT_OPTIONS( aParent, this, frame, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
case PANEL_FP_DEFAULT_VALUES:
|
case PANEL_FP_DEFAULT_VALUES:
|
||||||
|
@ -176,9 +176,9 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
||||||
frame = aKiway->Player( FRAME_PCB_EDITOR, false );
|
frame = aKiway->Player( FRAME_PCB_EDITOR, false );
|
||||||
|
|
||||||
if( frame )
|
if( frame )
|
||||||
return new PANEL_FP_EDITOR_DEFAULTS( aParent, frame );
|
SetUserUnits( frame->GetUserUnits() );
|
||||||
else
|
|
||||||
return new PANEL_FP_EDITOR_DEFAULTS( aParent, this );
|
return new PANEL_FP_EDITOR_DEFAULTS( aParent, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
case PANEL_FP_COLORS:
|
case PANEL_FP_COLORS:
|
||||||
|
@ -203,9 +203,9 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
||||||
frame = aKiway->Player( FRAME_FOOTPRINT_VIEWER, false );
|
frame = aKiway->Player( FRAME_FOOTPRINT_VIEWER, false );
|
||||||
|
|
||||||
if( frame )
|
if( frame )
|
||||||
return new PANEL_EDIT_OPTIONS( aParent, frame, frame, false );
|
SetUserUnits( frame->GetUserUnits() );
|
||||||
else
|
|
||||||
return new PANEL_EDIT_OPTIONS( aParent, this, nullptr, false );
|
return new PANEL_EDIT_OPTIONS( aParent, this, frame, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
case PANEL_PCB_COLORS:
|
case PANEL_PCB_COLORS:
|
||||||
|
|
Loading…
Reference in New Issue