De-initialize propertygrid when done

There doesn't appear to be a nice way to de-register wxPropertyGrids, so
we need to reach into the singleton and remove our registered editor.

Fixes https://gitlab.com/kicad/code/kicad/issues/12297
This commit is contained in:
Seth Hillbrand 2022-11-21 16:34:23 -08:00
parent 0e818360c4
commit 740dbdf09a
2 changed files with 16 additions and 5 deletions

View File

@ -38,8 +38,21 @@ PCB_PROPERTIES_PANEL::PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* a
{ {
m_propMgr.Rebuild(); m_propMgr.Rebuild();
m_editor = wxPropertyGrid::RegisterEditorClass( new PG_UNIT_EDITOR( m_frame ), m_editor = wxPropertyGrid::RegisterEditorClass( new PG_UNIT_EDITOR( m_frame ) );
wxT( "UnitEditor" ) ); }
PCB_PROPERTIES_PANEL::~PCB_PROPERTIES_PANEL()
{
auto it = wxPGGlobalVars->m_mapEditorClasses.find( m_editor->GetName() );
if( it != wxPGGlobalVars->m_mapEditorClasses.end() )
{
wxPGGlobalVars->m_mapEditorClasses.erase( it );
delete static_cast<PG_UNIT_EDITOR*>( it->second );
}
} }

View File

@ -34,9 +34,7 @@ class PCB_PROPERTIES_PANEL : public PROPERTIES_PANEL
public: public:
PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* aFrame ); PCB_PROPERTIES_PANEL( wxWindow* aParent, PCB_EDIT_FRAME* aFrame );
virtual ~PCB_PROPERTIES_PANEL() virtual ~PCB_PROPERTIES_PANEL();
{
}
void UpdateData() override; void UpdateData() override;