mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
pl_editor: fix a crash when trying to delete an item during its creation.
Fixes #12717 https://gitlab.com/kicad/code/kicad/issues/12717
This commit is contained in:
parent
75a3209e55
commit
7895b47030
@ -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-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2019-2022 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
|
||||||
@ -357,6 +357,14 @@ int PL_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||||||
if( selection.Size() == 0 )
|
if( selection.Size() == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Do not delete an item if it is currently a new item being created to avoid a crash
|
||||||
|
// In this case the selection contains only one item.
|
||||||
|
DS_DRAW_ITEM_BASE* currItem = static_cast<DS_DRAW_ITEM_BASE*>( selection.Front() );
|
||||||
|
|
||||||
|
if( currItem->GetFlags() & ( IS_NEW ) )
|
||||||
|
return 0;
|
||||||
|
|
||||||
m_frame->SaveCopyInUndoList();
|
m_frame->SaveCopyInUndoList();
|
||||||
|
|
||||||
while( selection.Front() )
|
while( selection.Front() )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user