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,
|
||||
wxStaticText* aLabel, wxWindow* aValueCtrl, wxStaticText* aUnitLabel,
|
||||
bool aAllowEval, bool aBindFocusEvent ) :
|
||||
m_eventSource( aEventSource ),
|
||||
m_bindFocusEvent( aBindFocusEvent ),
|
||||
m_label( aLabel ),
|
||||
m_valueCtrl( aValueCtrl ),
|
||||
|
@ -99,10 +98,10 @@ UNIT_BINDER::UNIT_BINDER( UNITS_PROVIDER* aUnitsProvider, wxWindow* aEventSource
|
|||
this );
|
||||
}
|
||||
|
||||
if( m_eventSource )
|
||||
if( aEventSource )
|
||||
{
|
||||
m_eventSource->Connect( UNITS_CHANGED, wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ),
|
||||
nullptr, this );
|
||||
aEventSource->Connect( UNITS_CHANGED, wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ),
|
||||
nullptr, this );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,12 +114,6 @@ UNIT_BINDER::~UNIT_BINDER()
|
|||
this );
|
||||
}
|
||||
|
||||
if( m_eventSource )
|
||||
{
|
||||
m_eventSource->Disconnect( UNITS_CHANGED, wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ),
|
||||
nullptr, this );
|
||||
}
|
||||
|
||||
if( m_valueCtrl )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
if( textEntry )
|
||||
textEntry->SetValue( value );
|
||||
else if( staticText )
|
||||
|
|
|
@ -140,7 +140,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
|||
void OnKifaceEnd() override;
|
||||
|
||||
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
|
||||
int aCtlBits = 0 ) override
|
||||
int aCtlBits = 0 ) override
|
||||
{
|
||||
switch( aClassId )
|
||||
{
|
||||
|
@ -204,9 +204,9 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
|||
frame = aKiway->Player( FRAME_SCH, false );
|
||||
|
||||
if( frame )
|
||||
return new PANEL_SYM_EDITING_OPTIONS( aParent, frame, frame );
|
||||
else
|
||||
return new PANEL_SYM_EDITING_OPTIONS( aParent, this, nullptr );
|
||||
SetUserUnits( frame->GetUserUnits() );
|
||||
|
||||
return new PANEL_SYM_EDITING_OPTIONS( aParent, this, frame );
|
||||
}
|
||||
|
||||
case PANEL_SYM_COLORS:
|
||||
|
@ -231,9 +231,9 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
|||
frame = aKiway->Player( FRAME_SCH_VIEWER, false );
|
||||
|
||||
if( frame )
|
||||
return new PANEL_EESCHEMA_EDITING_OPTIONS( aParent, frame, frame );
|
||||
else
|
||||
return new PANEL_EESCHEMA_EDITING_OPTIONS( aParent, this, nullptr );
|
||||
SetUserUnits( frame->GetUserUnits() );
|
||||
|
||||
return new PANEL_EESCHEMA_EDITING_OPTIONS( aParent, this, frame );
|
||||
}
|
||||
|
||||
case PANEL_SCH_ANNO_OPTIONS:
|
||||
|
|
|
@ -221,7 +221,6 @@ protected:
|
|||
double setPrecision( double aValue, bool aValueUsesUserUnits );
|
||||
|
||||
protected:
|
||||
wxWindow* m_eventSource;
|
||||
bool m_bindFocusEvent;
|
||||
|
||||
///< The bound widgets
|
||||
|
|
|
@ -86,7 +86,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
|||
void OnKifaceEnd() override;
|
||||
|
||||
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
|
||||
int aCtlBits = 0 ) override
|
||||
int aCtlBits = 0 ) override
|
||||
{
|
||||
switch( aClassId )
|
||||
{
|
||||
|
@ -160,9 +160,9 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
|||
frame = aKiway->Player( FRAME_PCB_EDITOR, false );
|
||||
|
||||
if( frame )
|
||||
return new PANEL_EDIT_OPTIONS( aParent, frame, frame, true );
|
||||
else
|
||||
return new PANEL_EDIT_OPTIONS( aParent, this, nullptr, true );
|
||||
SetUserUnits( frame->GetUserUnits() );
|
||||
|
||||
return new PANEL_EDIT_OPTIONS( aParent, this, frame, true );
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
if( frame )
|
||||
return new PANEL_FP_EDITOR_DEFAULTS( aParent, frame );
|
||||
else
|
||||
return new PANEL_FP_EDITOR_DEFAULTS( aParent, this );
|
||||
SetUserUnits( frame->GetUserUnits() );
|
||||
|
||||
return new PANEL_FP_EDITOR_DEFAULTS( aParent, this );
|
||||
}
|
||||
|
||||
case PANEL_FP_COLORS:
|
||||
|
@ -203,9 +203,9 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
|||
frame = aKiway->Player( FRAME_FOOTPRINT_VIEWER, false );
|
||||
|
||||
if( frame )
|
||||
return new PANEL_EDIT_OPTIONS( aParent, frame, frame, false );
|
||||
else
|
||||
return new PANEL_EDIT_OPTIONS( aParent, this, nullptr, false );
|
||||
SetUserUnits( frame->GetUserUnits() );
|
||||
|
||||
return new PANEL_EDIT_OPTIONS( aParent, this, frame, false );
|
||||
}
|
||||
|
||||
case PANEL_PCB_COLORS:
|
||||
|
|
Loading…
Reference in New Issue