pcbnew crashes when removing pad number
Description
Kicad crashes when removing (editing?) the pad number of a footprint on a board.
It doesn't always happen but I can usually get it to happen on the first or second try. Once (out of ~20 tries) I got an assertion:
ASSERT INFO:
../pcbnew/board_connected_item.cpp(60): assert "m_netinfo" failed in SetNetCode().
BACKTRACE:
[1] make_fcontext
Sometimes it crashes after saving the footprint to the board and exiting the footprint editor to go back to pcbnew.
Sometimes it crashes while opening up the footprint editor (to edit a second pad, after editing the first pad with no crash).
Once I got it to crash after editing the pad number, but before saving the footprint and going back to pcbnew.
It seems to crash more reliably when the footprint has nets attached to the pads but I have also gotten crashes with netless footprints (i.e. press "O" to add a free footprint, remove pad numbers, crash).
gdb didn't give me much, but that's probably my fault. It did freeze my computer for a few minutes while it tried and failed to get a backtrace.
Thread 1 "kicad" received signal SIGSEGV, Segmentation fault.
std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::basic_string (__str=<error reading variable: Cannot access memory at address 0x9>, this=0x7fffffffa7a0) at /usr/include/c++/10.2.0/bits/basic_string.h:451
451 { _M_construct(__str._M_data(), __str._M_data() + __str.length()); }
(gdb) bt
Killed
I'm attaching a simple test project: an opamp with all pins shorted together. This one seems to crash pretty reliably while opening up the footprint to edit a second time, and sometimes sooner. pad-number-crash-test.zip
Steps to reproduce
- select footprint
- Press E
- "Edit Footprint"
- Select pad
- Press E
- Delete pad number
- OK
- Save footprint
- Close footprint editor
- GOTO 1
If it takes more than a couple of tries to get a crash, close pcbnew (don't save changes) and try again.
screencast: screencast_kicad_pad_num_crash
KiCad Version
Application: KiCad PCB Editor
Version: (5.99.0-9519-ga70106a3bd), debug build
Libraries:
wxWidgets 3.0.5
libcurl/7.75.0 OpenSSL/1.1.1j zlib/1.2.11 zstd/1.4.8 libidn2/2.3.0 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.41.0
Platform: Linux 5.10.19-1-lts x86_64, 64 bit, Little endian, wxGTK, KDE, x11
Build Info:
Date: Feb 28 2021 05:39:34
wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.75.0
OCC: 7.5.0
Curl: 7.75.0
ngspice: 33
Compiler: GCC 10.2.0 with C++ ABI 1014
Build settings:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=ON
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
KICAD_SCRIPTING_ACTION_MENU=ON
KICAD_USE_OCC=ON
KICAD_SPICE=ON
KICAD_STDLIB_DEBUG=OFF
KICAD_STDLIB_LIGHT_DEBUG=OFF
KICAD_SANITIZE=OFF