Don't pass a FRAME-based UNITS_PROVIDER to a modeless dialog.
(The dialog may outlive said frame.) Should fix Sentry KICAD-3A.
This commit is contained in:
parent
98e846459a
commit
9b4627e782
|
@ -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,11 +98,11 @@ UNIT_BINDER::UNIT_BINDER( UNITS_PROVIDER* aUnitsProvider, wxWindow* aEventSource
|
|||
this );
|
||||
}
|
||||
|
||||
if( m_eventSource )
|
||||
if( aEventSource )
|
||||
{
|
||||
m_eventSource->Connect( EDA_EVT_UNITS_CHANGED,
|
||||
wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ),
|
||||
nullptr, this );
|
||||
aEventSource->Connect( EDA_EVT_UNITS_CHANGED,
|
||||
wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ),
|
||||
nullptr, this );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,13 +115,6 @@ UNIT_BINDER::~UNIT_BINDER()
|
|||
this );
|
||||
}
|
||||
|
||||
if( m_eventSource )
|
||||
{
|
||||
m_eventSource->Disconnect( EDA_EVT_UNITS_CHANGED,
|
||||
wxCommandEventHandler( UNIT_BINDER::onUnitsChanged ),
|
||||
nullptr, this );
|
||||
}
|
||||
|
||||
if( m_valueCtrl )
|
||||
{
|
||||
m_valueCtrl->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( UNIT_BINDER::onSetFocus ),
|
||||
|
|
|
@ -144,7 +144,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 )
|
||||
{
|
||||
|
@ -207,9 +207,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:
|
||||
|
@ -234,9 +234,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