Pcbnew, undo redo: fix a crash in legacy mode when undo a footprint change (for instance a 45 degrees rotation)

This commit is contained in:
jean-pierre charras 2016-09-29 19:34:51 +02:00
parent ab0cf7dee1
commit 1ebac06d2f
1 changed files with 11 additions and 7 deletions

View File

@ -188,7 +188,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
// is changed).
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
ITEM_PICKER picker = aItemsList.GetItemWrapper(ii);
ITEM_PICKER curr_picker = aItemsList.GetItemWrapper(ii);
BOARD_ITEM* item = (BOARD_ITEM*) aItemsList.GetPickedItem( ii );
// For items belonging to modules, we need to save state of the parent module
@ -222,8 +222,9 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
clone->SetParent( GetBoard() );
// Clear current flags (which can be temporary set by a current edit command)
for( EDA_ITEM* item = clone->GraphicalItems(); item; item = item->Next() )
item->ClearFlags();
for( EDA_ITEM* loc_item = clone->GraphicalItems(); loc_item;
loc_item = loc_item->Next() )
loc_item->ClearFlags();
for( D_PAD* pad = clone->Pads(); pad; pad = pad->Next() )
pad->ClearFlags();
@ -241,10 +242,11 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
{
continue;
}
} else {
}
else
{
// Normal case: all other BOARD_ITEMs, are simply copied to the new list
commandToUndo->PushItem( picker );
commandToUndo->PushItem( curr_picker );
}
}
@ -376,7 +378,7 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
BOARD_ITEM* item;
bool not_found = false;
bool reBuild_ratsnest = false;
bool deep_reBuild_ratsnest = false;
bool deep_reBuild_ratsnest = false; // true later if pointers must be rebuilt
KIGFX::VIEW* view = GetGalCanvas()->GetView();
RN_DATA* ratsnest = GetBoard()->GetRatsnest();
@ -429,6 +431,8 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
switch( item->Type() )
{
case PCB_MODULE_T:
deep_reBuild_ratsnest = true;
// Fall though
case PCB_ZONE_AREA_T:
case PCB_TRACE_T:
case PCB_VIA_T: