mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 10:43:15 +02:00
Free allocated DRC structures when re-initializing.
Fixes https://gitlab.com/kicad/code/kicad/issues/6147
This commit is contained in:
parent
346b7178b7
commit
7674d2ba91
@ -70,6 +70,17 @@ DRC_ENGINE::DRC_ENGINE( BOARD* aBoard, BOARD_DESIGN_SETTINGS *aSettings ) :
|
|||||||
|
|
||||||
DRC_ENGINE::~DRC_ENGINE()
|
DRC_ENGINE::~DRC_ENGINE()
|
||||||
{
|
{
|
||||||
|
for( DRC_RULE* rule : m_rules )
|
||||||
|
delete rule;
|
||||||
|
|
||||||
|
for( std::pair< DRC_CONSTRAINT_TYPE_T,
|
||||||
|
std::vector<CONSTRAINT_WITH_CONDITIONS*>* > pair : m_constraintMap )
|
||||||
|
{
|
||||||
|
for( CONSTRAINT_WITH_CONDITIONS* constraintWithCondition : *pair.second )
|
||||||
|
delete constraintWithCondition;
|
||||||
|
|
||||||
|
delete pair.second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -484,9 +495,8 @@ void DRC_ENGINE::loadRules( const wxFileName& aPath )
|
|||||||
|
|
||||||
void DRC_ENGINE::compileRules()
|
void DRC_ENGINE::compileRules()
|
||||||
{
|
{
|
||||||
ReportAux( wxString::Format( "Compiling Rules (%d rules, %d conditions): ",
|
ReportAux( wxString::Format( "Compiling Rules (%d rules): ",
|
||||||
(int) m_rules.size(),
|
(int) m_rules.size() ) );
|
||||||
(int) m_ruleConditions.size() ) );
|
|
||||||
|
|
||||||
for( DRC_TEST_PROVIDER* provider : m_testProviders )
|
for( DRC_TEST_PROVIDER* provider : m_testProviders )
|
||||||
{
|
{
|
||||||
@ -569,10 +579,23 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
|
|||||||
provider->SetDRCEngine( this );
|
provider->SetDRCEngine( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ruleConditions.clear();
|
for( DRC_RULE* rule : m_rules )
|
||||||
|
delete rule;
|
||||||
|
|
||||||
m_rules.clear();
|
m_rules.clear();
|
||||||
m_rulesValid = false;
|
m_rulesValid = false;
|
||||||
|
|
||||||
|
for( std::pair< DRC_CONSTRAINT_TYPE_T,
|
||||||
|
std::vector<CONSTRAINT_WITH_CONDITIONS*>* > pair : m_constraintMap )
|
||||||
|
{
|
||||||
|
for( CONSTRAINT_WITH_CONDITIONS* constraintWithCondition : *pair.second )
|
||||||
|
delete constraintWithCondition;
|
||||||
|
|
||||||
|
delete pair.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_constraintMap.clear();
|
||||||
|
|
||||||
try // attempt to load full set of rules (implicit + user rules)
|
try // attempt to load full set of rules (implicit + user rules)
|
||||||
{
|
{
|
||||||
loadImplicitRules();
|
loadImplicitRules();
|
||||||
|
@ -213,7 +213,6 @@ protected:
|
|||||||
KIGFX::WS_PROXY_VIEW_ITEM* m_worksheet;
|
KIGFX::WS_PROXY_VIEW_ITEM* m_worksheet;
|
||||||
NETLIST* m_schematicNetlist;
|
NETLIST* m_schematicNetlist;
|
||||||
|
|
||||||
std::vector<DRC_RULE_CONDITION*> m_ruleConditions;
|
|
||||||
std::vector<DRC_RULE*> m_rules;
|
std::vector<DRC_RULE*> m_rules;
|
||||||
bool m_rulesValid;
|
bool m_rulesValid;
|
||||||
std::vector<DRC_TEST_PROVIDER*> m_testProviders;
|
std::vector<DRC_TEST_PROVIDER*> m_testProviders;
|
||||||
|
@ -78,6 +78,7 @@ public:
|
|||||||
void SetDRCEngine( DRC_ENGINE *engine )
|
void SetDRCEngine( DRC_ENGINE *engine )
|
||||||
{
|
{
|
||||||
m_drcEngine = engine;
|
m_drcEngine = engine;
|
||||||
|
m_stats.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,7 +127,7 @@ protected:
|
|||||||
DRC_ENGINE* m_drcEngine;
|
DRC_ENGINE* m_drcEngine;
|
||||||
std::unordered_map<const DRC_RULE*, int> m_stats;
|
std::unordered_map<const DRC_RULE*, int> m_stats;
|
||||||
bool m_isRuleDriven = true;
|
bool m_isRuleDriven = true;
|
||||||
bool m_enabled = true;
|
bool m_enabled = true;
|
||||||
|
|
||||||
wxString m_msg; // Allocating strings gets expensive enough to want to avoid it
|
wxString m_msg; // Allocating strings gets expensive enough to want to avoid it
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user