diff --git a/pcbnew/widgets/pcb_properties_panel.cpp b/pcbnew/widgets/pcb_properties_panel.cpp index 9457bae4af..d25d1ac3c5 100644 --- a/pcbnew/widgets/pcb_properties_panel.cpp +++ b/pcbnew/widgets/pcb_properties_panel.cpp @@ -42,11 +42,9 @@ PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* a m_propMgr.Rebuild(); bool found = false; - PG_UNIT_EDITOR* new_editor = new PG_UNIT_EDITOR( m_frame ); - 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() ) { @@ -56,10 +54,11 @@ PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* a } } - if( found ) - delete new_editor; - else + if( !found ) + { + PG_UNIT_EDITOR* new_editor = new PG_UNIT_EDITOR( m_frame ); m_editor = static_cast( wxPropertyGrid::RegisterEditorClass( new_editor ) ); + } }