Fix freed-memory crasher.

While the DRC_ENGINE is not long-lived, it's test providers are,
and must be cleared for each use.
This commit is contained in:
Jeff Young 2020-10-29 13:18:15 +00:00
parent 115fd1d7f3
commit a9bf4bc6a6
3 changed files with 6 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020 CERN
*
* This program is free software; you can redistribute it and/or
@ -82,7 +82,7 @@ public:
/**
* Function Insert()
* Inserts an item into the tree. Item's bounding box is taken via its GetBoundingBox() method.
* Inserts an item into the tree.
*/
void insert( BOARD_ITEM* aItem, int aWorstClearance = 0, int aLayer = UNDEFINED_LAYER )
{

View File

@ -27,7 +27,6 @@
#include <class_pad.h>
#include <class_track.h>
#include <geometry/shape_arc.h>
#include <geometry/seg.h>
#include <geometry/shape_poly_set.h>
#include <geometry/shape_rect.h>
@ -144,6 +143,8 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::Run()
size_t count = 0;
size_t ii = 0;
m_copperTree.clear();
auto countItems =
[&]( BOARD_ITEM* item ) -> bool
{

View File

@ -117,6 +117,8 @@ bool DRC_TEST_PROVIDER_HOLE_CLEARANCE::Run()
size_t count = 0;
size_t ii = 0;
m_holeTree.clear();
auto countItems =
[&]( BOARD_ITEM* item ) -> bool
{