Eeschema: fix an assert ( "meOwner" failed in DeleteAll() ) when appending a sheet from an other project to the schematic.

It was only a overzealous (in this case) assert, with no issue.
The fix avoid calling DeleteAll() when there is nothing to delete.

Fixes: lp:1787810
https://bugs.launchpad.net/kicad/+bug/1787810
This commit is contained in:
jean-pierre charras 2018-08-22 17:10:25 +02:00
parent 7e2e39ce30
commit 333ba4b9a2
1 changed files with 7 additions and 1 deletions

View File

@ -117,6 +117,12 @@ SCH_SCREEN::SCH_SCREEN( KIWAY* aKiway ) :
SCH_SCREEN::~SCH_SCREEN()
{
ClearUndoRedoList();
// Now delete items in draw list. We do that only if the list is not empty,
// because if the list was appended to another list (see SCH_SCREEN::Append( SCH_SCREEN* aScreen )
// it is empty but as no longer the ownership (m_drawList.meOwner == false) of items, and calling
// FreeDrawList() with m_drawList.meOwner == false will generate a debug alert in debug mode
if( GetDrawItems() )
FreeDrawList();
}