Fix some memory leaks
Some elements of modules and boards were not deleted, so memory was being leaked on some library loads and single-instance pcbnew usage.
This commit is contained in:
parent
7bb046c0a5
commit
d170243d61
|
@ -165,6 +165,13 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
|
|||
|
||||
KICAD_MANAGER_FRAME::~KICAD_MANAGER_FRAME()
|
||||
{
|
||||
// Ensure there are no active tools
|
||||
if( m_toolManager )
|
||||
m_toolManager->DeactivateTool();
|
||||
|
||||
delete m_actions;
|
||||
delete m_toolManager;
|
||||
|
||||
m_auimgr.UnInit();
|
||||
}
|
||||
|
||||
|
|
|
@ -146,9 +146,28 @@ BOARD::~BOARD()
|
|||
Delete( area_to_remove );
|
||||
}
|
||||
|
||||
// Clean up the owned elements
|
||||
DeleteMARKERs();
|
||||
DeleteZONEOutlines();
|
||||
|
||||
// Delete the modules
|
||||
for( auto m : m_modules )
|
||||
delete m;
|
||||
|
||||
m_modules.clear();
|
||||
|
||||
// Delete the tracks
|
||||
for( auto t : m_tracks )
|
||||
delete t;
|
||||
|
||||
m_tracks.clear();
|
||||
|
||||
// Delete the drawings
|
||||
for (auto d : m_drawings )
|
||||
delete d;
|
||||
|
||||
m_drawings.clear();
|
||||
|
||||
delete m_CurrentZoneContour;
|
||||
m_CurrentZoneContour = NULL;
|
||||
}
|
||||
|
|
|
@ -142,9 +142,20 @@ MODULE::MODULE( const MODULE& aModule ) :
|
|||
|
||||
MODULE::~MODULE()
|
||||
{
|
||||
// Clean up the owned elements
|
||||
delete m_Reference;
|
||||
delete m_Value;
|
||||
delete m_initial_comments;
|
||||
|
||||
for( auto p : m_pads )
|
||||
delete p;
|
||||
|
||||
m_pads.clear();
|
||||
|
||||
for( auto d : m_drawings )
|
||||
delete d;
|
||||
|
||||
m_drawings.clear();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue