Fixed a memleak when no undo entry is requested in BOARD_COMMIT

This commit is contained in:
Maciej Suminski 2017-10-31 09:14:03 +01:00
parent 93e7d52633
commit 05ab44f463
1 changed files with 9 additions and 2 deletions

View File

@ -264,9 +264,16 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry )
module->RunOnChildren( [&view] ( BOARD_ITEM* aItem ) { view->Update( aItem ); } );
}
view->Update ( boardItem );
connectivity->MarkItemNetAsDirty( static_cast<BOARD_ITEM*>( ent.m_copy ) );
if( ent.m_copy )
connectivity->MarkItemNetAsDirty( static_cast<BOARD_ITEM*>( ent.m_copy ) );
connectivity->Update( boardItem );
view->Update( boardItem );
// if no undo entry is needed, the copy would create a memory leak
if( !aCreateUndoEntry )
delete ent.m_copy;
break;
}