Don't allocate/delete a PG_UNIT_EDITOR unless needed
We cannot actually delete the PG_UNIT_EDITOR without substantial issues from the global variables in wx.
This commit is contained in:
parent
1b18e1eb6a
commit
47e7cd2e90
|
@ -42,11 +42,9 @@ PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* a
|
||||||
m_propMgr.Rebuild();
|
m_propMgr.Rebuild();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
PG_UNIT_EDITOR* new_editor = new PG_UNIT_EDITOR( m_frame );
|
|
||||||
|
|
||||||
if( wxPGGlobalVars )
|
if( wxPGGlobalVars )
|
||||||
{
|
{
|
||||||
auto it = wxPGGlobalVars->m_mapEditorClasses.find( new_editor->GetName() );
|
auto it = wxPGGlobalVars->m_mapEditorClasses.find( PG_UNIT_EDITOR::EDITOR_NAME );
|
||||||
|
|
||||||
if( it != wxPGGlobalVars->m_mapEditorClasses.end() )
|
if( it != wxPGGlobalVars->m_mapEditorClasses.end() )
|
||||||
{
|
{
|
||||||
|
@ -56,10 +54,11 @@ PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( found )
|
if( !found )
|
||||||
delete new_editor;
|
{
|
||||||
else
|
PG_UNIT_EDITOR* new_editor = new PG_UNIT_EDITOR( m_frame );
|
||||||
m_editor = static_cast<PG_UNIT_EDITOR*>( wxPropertyGrid::RegisterEditorClass( new_editor ) );
|
m_editor = static_cast<PG_UNIT_EDITOR*>( wxPropertyGrid::RegisterEditorClass( new_editor ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue