On 2/13/2013 6:53 PM, Anton Blanchard wrote:
Hi,
I get a SEGV in the module editor when using delete on an area without any item:
(gdb) backtrace
#0 0x000000000067b7f2 in EDA_ITEM::Type (this=0x0) at
kicad/include/base_struct.h:439
#1 0x000000000082f330 in FOOTPRINT_EDIT_FRAME::OnLeftClick
(this=0x12bde70, DC=0x7fffffffd400, MousePos=...) at
kicad/pcbnew/modedit_onclick.cpp:125
#2 0x00000000009bd78e in EDA_DRAW_PANEL::OnMouseEvent
(this=0x12ac6d0, event=...) at kicad/common/drawpanel.cpp:967
The following patch fixes it by checking that we have a valid item
before dereferencing it.
Anton
--
Index: b/pcbnew/modedit_onclick.cpp
===================================================================
--- a/pcbnew/modedit_onclick.cpp
+++ b/pcbnew/modedit_onclick.cpp
@@ -122,7 +122,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick(
break;
item = ModeditLocateAndDisplay();
- if( item->Type() != PCB_MODULE_T ) // Cannot delete the module itself
+ if( item && item->Type() != PCB_MODULE_T ) // Cannot delete the module
itself
{
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
RemoveStruct( item );
Anton,
Sorry it took so long but good catch and thank you for the patch. It
has been committed in the KiCad testing branch version r3970.
Regards,
Wayne
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp