Eeschema: fix crash when undo called during item edit.
Add EDA_DRAW_FRAME::isBusy() method to test if the current item is being edited or a block operation is in progress. Ignore undo and redo commands when editor is busy. Fixes lp:1718656 https://bugs.launchpad.net/kicad/+bug/1718656
This commit is contained in:
parent
cb764d73c5
commit
427e5ec461
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -1370,3 +1370,14 @@ void EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool EDA_DRAW_FRAME::isBusy() const
|
||||
{
|
||||
const BASE_SCREEN* screen = const_cast< BASE_SCREEN* >( GetScreen() );
|
||||
|
||||
if( !screen )
|
||||
return false;
|
||||
|
||||
return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
|
||||
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -338,7 +338,7 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
|||
|
||||
void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
|
||||
{
|
||||
if( GetScreen()->GetUndoCommandCount() <= 0 )
|
||||
if( GetScreen()->GetUndoCommandCount() <= 0 || isBusy() )
|
||||
return;
|
||||
|
||||
/* Get the old list */
|
||||
|
@ -361,7 +361,7 @@ void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
|
|||
|
||||
void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
|
||||
{
|
||||
if( GetScreen()->GetRedoCommandCount() == 0 )
|
||||
if( GetScreen()->GetRedoCommandCount() == 0 || isBusy() )
|
||||
return;
|
||||
|
||||
/* Get the old list */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2011-2017 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -154,11 +154,16 @@ protected:
|
|||
* cursor keys (i.e. cursor movement by keyboard) */
|
||||
void GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid );
|
||||
|
||||
/* Function RefreshCrosshair
|
||||
* Move and refresh the crosshair after movement; also call the
|
||||
* mouse capture function, if active.
|
||||
/**
|
||||
* Move and refresh the crosshair after movement and call the mouse capture function.
|
||||
*/
|
||||
void RefreshCrossHair( const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC* aDC );
|
||||
|
||||
/**
|
||||
* @return true if an item edit or a block operation is in progress.
|
||||
*/
|
||||
bool isBusy() const;
|
||||
|
||||
public:
|
||||
EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
FRAME_T aFrameType,
|
||||
|
|
Loading…
Reference in New Issue