Crash while reading netlist
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
KiCad |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Pcbnew crashes with my current project while reading the netlist and the option
"Extra Footprints" is set to "Delete".
I have not found a way to reproduce this bug with another project.
But I did some digging and found out that the crash occurs while doing this loop
in class_board.
for( const auto cnItem : connAlgo->PadList() )
{
int net = cnItem-
if( net > 0 )
}
Here, Parent() returns an invalid object. cnItem itself seems to valid but its m_valid member
is false.
(gdb) frame 2
#2 0x00007fffd688702b in BOARD::
at /data/src/
2675 int net = cnItem-
(gdb) p *cnItem
$1 = {<INTRUSIVE_
0x3019a40, m_connected = std::vector of length 4, capacity 4 = {0x3aa1470, 0x2c07de0, 0x2859ce0, 0x2f42c90},
m_anchors = std::vector of length 1, capacity 2 = {std::shared_ptr (count 5, weak 0) 0x270ec10}, m_visited = true, m_canChangeNet = false, m_valid = false,
m_dirty = false}
(gdb) p *cnItem->m_parent
$3 = {<BOARD_ITEM> = {<EDA_ITEM> = {<KIGFX::VIEW_ITEM> = {_vptr.VIEW_ITEM = 0x6400000022, m_viewPrivData = 0x7200000061}, m_StructType = 107, m_Status = 103,
Pnext = 0x6500000072, Pback = 0x6e00000065, m_List = 0x2000000022, m_Parent = 0x6900000073, m_TimeStamp = 433791697018, m_forceVisible = 61, m_Flags = 50},
m_Layer = 62, static ZeroOffset = {x = 0, y = 0}}, m_netinfo = 0x6d00000065, m_localRatsnest
(gdb) p *cnItem-
Cannot access memory at address 0x6500000072
(gdb) p *cnItem-
Cannot access memory at address 0x6e00000065
I tried a workaround that relies on the m_valid flag:
class_board.
for( const auto cnItem : connAlgo->PadList() )
{
if( !cnItem->Valid() )
continue;
int net = cnItem-
if( net > 0 )
}
In connectivity.
but I cannot tell if there are any side effects.
-----------------
First GDB output:
Thread 1 "kicad" received signal SIGSEGV, Segmentation fault.
0x00007fffd61b15d2 in NETINFO_
227 int GetNet() const { return m_NetCode; }
Backtrace:
#0 0x00007fffd6
1b15d2 in NETINFO_
#1 0x00007fffd61b15f4 in BOARD_CONNECTED
#2 0x00007fffd688702b in BOARD::
at /data/src/
#3 0x00007fffd640b298 in PCB_EDIT_
aDeleteUnco
at /data/src/
#4 0x00007fffd62ca386 in DIALOG_
at /data/src/
#5 0x00007ffff67d11fe in wxAppConsoleBas
#6 0x00007ffff69576e7 in wxEvtHandler:
from /usr/lib/
#7 0x00007ffff6957ace in wxEvtHandler:
#8 0x00007ffff6957b5f in wxEvtHandler:
#9 0x00007ffff6957c13 in wxEvtHandler:
#10 0x00007ffff6957c75 in wxEvtHandler:
#11 0x00007ffff69579e7 in wxEvtHandler:
#12 0x00007ffff6edfb57 in ?? () from /usr/lib/
#13 0x00007ffff4b371d4 in ?? () from /usr/lib/
#14 0x00007ffff4b519a6 in g_signal_
#15 0x00007ffff4b5208f in g_signal_emit () from /usr/lib/
#16 0x00007ffff50bbf35 in ?? () from /usr/lib/
#17 0x00007ffff4b371d4 in ?? () from /usr/lib/
#18 0x00007ffff4b519a6 in g_signal_
#19 0x00007ffff4b5208f in g_signal_emit () from /usr/lib/
#20 0x00007ffff50bae79 in ?? () from /usr/lib/
#21 0x00007ffff5161aec in ?? () from /usr/lib/
#22 0x00007ffff4b36fa5 in g_closure_invoke () from /usr/lib/
Version info:
Application: kicad
Version: (2017-08-12 revision 0e41632)-master, release build
Libraries: wxWidgets 3.0.2
Platform: Linux 4.10.0-30-generic x86_64, 64 bit, Little endian, wxGTK
- Build Info -
wxWidgets: 3.0.2 (wchar_t,wx containers,
Boost: 1.58.0
Curl: 7.47.0
KiCad - Compiler: GCC 5.4.0 with C++ ABI 1009
Settings: USE_WX_
Changed in kicad: | |
status: | Fix Committed → Fix Released |
@Orson, in BOARD:: ReplaceNetlist( ) we delete extra footprints around line 2658. This will delete the footprint's pads from the itemMap, but only dirties the padList.
Later, when checking for single-connection pads (around line 2699), we use the padList.
Do we need to do something like:
if( connAlgo->isDirty() )
connAlgo- >searchConnecti ons( includeZones );
to clean the dirty padList before using it?