When undoing creation of the sheet, get out first
We can't stay in a sheet that is deleted by the action of undo. Checks the current sheet and, if we are currently using it, ensures that the following action is to leave the current sheet Fixes https://gitlab.com/kicad/code/kicad/issues/10733
This commit is contained in:
parent
901685f01b
commit
ccf2a63f45
|
@ -22,6 +22,7 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <ee_actions.h>
|
||||||
#include <sch_edit_frame.h>
|
#include <sch_edit_frame.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <schematic.h>
|
#include <schematic.h>
|
||||||
|
@ -283,7 +284,13 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
||||||
}
|
}
|
||||||
if( status == UNDO_REDO::NEWITEM )
|
if( status == UNDO_REDO::NEWITEM )
|
||||||
{
|
{
|
||||||
// new items are deleted on undo
|
// If we are removing the current sheet, get out first
|
||||||
|
if( SCH_SHEET* sheet = dyn_cast<SCH_SHEET*>( eda_item ) )
|
||||||
|
{
|
||||||
|
if( sheet->GetScreen() == GetScreen() )
|
||||||
|
GetToolManager()->RunAction( EE_ACTIONS::leaveSheet );
|
||||||
|
}
|
||||||
|
|
||||||
RemoveFromScreen( eda_item, screen );
|
RemoveFromScreen( eda_item, screen );
|
||||||
aList->SetPickedItemStatus( UNDO_REDO::DELETED, ii );
|
aList->SetPickedItemStatus( UNDO_REDO::DELETED, ii );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue