Remove confused dynamic_cast
dynamic_cast could not resolve the cast chain leading to a null undo point. Since we know the item to be LIB_ITEM, we can use static_cast anyway and avoid the overhead. Fixes #3771 | https://gitlab.com/kicad/code/kicad/issues/3771
This commit is contained in:
parent
27db1c90bc
commit
40f97b55c7
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2014-2017 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 2014-2020 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -162,6 +162,11 @@ void LIB_EDIT_FRAME::RollbackPartFromUndo()
|
||||||
|
|
||||||
// Load the last undo entry
|
// Load the last undo entry
|
||||||
PICKED_ITEMS_LIST* undoCommand = GetScreen()->PopCommandFromUndoList();
|
PICKED_ITEMS_LIST* undoCommand = GetScreen()->PopCommandFromUndoList();
|
||||||
|
|
||||||
|
// Check if we were already at the top of the stack
|
||||||
|
if( !undoCommand )
|
||||||
|
return;
|
||||||
|
|
||||||
ITEM_PICKER undoWrapper = undoCommand->PopItem();
|
ITEM_PICKER undoWrapper = undoCommand->PopItem();
|
||||||
delete undoCommand;
|
delete undoCommand;
|
||||||
LIB_PART* part = (LIB_PART*) undoWrapper.GetItem();
|
LIB_PART* part = (LIB_PART*) undoWrapper.GetItem();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019 CERN
|
* Copyright (C) 2019 CERN
|
||||||
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -129,7 +129,7 @@ protected:
|
||||||
LIB_EDIT_FRAME* editFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
|
LIB_EDIT_FRAME* editFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
|
||||||
wxASSERT( editFrame );
|
wxASSERT( editFrame );
|
||||||
|
|
||||||
editFrame->SaveCopyInUndoList( dynamic_cast<LIB_ITEM*>( aItem ), aType, aAppend );
|
editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( aItem ), aType, aAppend );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -138,9 +138,9 @@ protected:
|
||||||
|
|
||||||
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
|
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
|
||||||
editFrame->SaveCopyInUndoList(
|
editFrame->SaveCopyInUndoList(
|
||||||
dynamic_cast<SCH_ITEM*>( aItem->GetParent() ), UR_CHANGED, aAppend );
|
static_cast<SCH_ITEM*>( aItem->GetParent() ), UR_CHANGED, aAppend );
|
||||||
else
|
else
|
||||||
editFrame->SaveCopyInUndoList( dynamic_cast<SCH_ITEM*>( aItem ), aType, aAppend );
|
editFrame->SaveCopyInUndoList( static_cast<SCH_ITEM*>( aItem ), aType, aAppend );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( selected && aItem->HasFlag( TEMP_SELECTED ) )
|
if( selected && aItem->HasFlag( TEMP_SELECTED ) )
|
||||||
|
|
Loading…
Reference in New Issue