KiCad crashes after closing PCBNew if a python script was executed before
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
KiCad |
Fix Committed
|
Critical
|
jean-pierre charras |
Bug Description
Running a python-script in PCBNew, e.g. InteractiveHtmlBom (https:/
Version:
Application: KiCad
Version: (5.99.0-
Libraries:
wxWidgets 3.0.4
libcurl/7.61.1 OpenSSL/1.1.1 (WinSSL) zlib/1.2.11 brotli/1.0.6 libidn2/2.0.5 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.34.0
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,
Boost: 1.68.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.61.1
Compiler: GCC 8.2.0 with C++ ABI 1013
Build settings:
KICAD_
KICAD_
KICAD_
KICAD_
KICAD_
KICAD_
BUILD_
KICAD_
KICAD_
KICAD_SPICE=ON
This happens for simple plugins as well (tested with the attached plugin). The stack trace from address sanitizer is below.
======= ======= ======= ======= ======= ======= ======= ======= ======= == pcbnew/ class_board. cpp:155: 9 pcbnew/ class_board. cpp:142: 1 FRAME:: ~PCB_BASE_ FRAME() /master/ pcbnew/ pcb_base_ frame.cpp: 108:5 EDIT_FRAME: :~PCB_BASE_ EDIT_FRAME( ) /master/ pcbnew/ pcb_base_ edit_frame. cpp:53: 1 FRAME:: ~PCB_EDIT_ FRAME() /master/ pcbnew/ pcb_edit_ frame.cpp: 339:1 FRAME:: ~PCB_EDIT_ FRAME() /master/ pcbnew/ pcb_edit_ frame.cpp: 338:1 e::DeletePendin gObjects( ) ../src/ common/ appbase. cpp:591: 16 e::ProcessIdle( ) ../src/ common/ appbase. cpp:397: 25 :ProcessIdle( ) ../src/ common/ appcmn. cpp:366: 50 gtk/app. cpp:159: 31 gtk/app. cpp:107: 28 libglib- 2.0.so. 0+0x4c7da) context_ dispatch (/lib64/ libglib- 2.0.so. 0+0x4fedc) libglib- 2.0.so. 0+0x5026f) libglib- 2.0.so. 0+0x505a2) libgtk- 3.so.0+ 0x24db3c) :DoRun( ) ../src/ gtk/evtloop. cpp:65: 17 ::Run() ../src/ common/ evtloopcmn. cpp:78: 17 e::MainLoop( ) ../src/ common/ appbase. cpp:334: 40 kicad/kicad. cpp:261: 27 common/ init.cpp: 506:31 kicad/kicad. cpp:292: 1 libc.so. 6+0x23f32) build/debug/ kicad/kicad+ 0x40302d)
==12840==ERROR: AddressSanitizer: heap-use-after-free on address 0x61900004b580 at pc 0x7fcfa05be4aa bp 0x7fff775ea390 sp 0x7fff775ea388
READ of size 8 at 0x61900004b580 thread T0
#0 0x7fcfa05be4a9 in BOARD::~BOARD() /master/
#1 0x7fcfa05be9dd in BOARD::~BOARD() /master/
#2 0x7fcfa059c70c in PCB_BASE_
#3 0x7fcf9fce9008 in PCB_BASE_
#4 0x7fcf9fcfc205 in PCB_EDIT_
#5 0x7fcf9fcfc22d in PCB_EDIT_
#6 0x7fcfab2429c6 in wxAppConsoleBas
#7 0x7fcfab242a48 in wxAppConsoleBas
#8 0x7fcfab8434a7 in wxAppBase:
#9 0x7fcfab76d094 in wxApp::DoIdle() ../src/
#10 0x7fcfab76d1b6 ../src/
#11 0x7fcfa977f7da (/lib64/
#12 0x7fcfa9782edc in g_main_
#13 0x7fcfa978326f (/lib64/
#14 0x7fcfa97835a2 in g_main_loop_run (/lib64/
#15 0x7fcfa9dc1b3c in gtk_main (/lib64/
#16 0x7fcfab78cbc4 in wxGUIEventLoop:
#17 0x7fcfab285170 in wxEventLoopBase
#18 0x7fcfab245c69 in wxAppConsoleBas
#19 0x53c770 in APP_KICAD::OnRun() /master/
#20 0x7fcfab2d9abb in wxEntry(int&, wchar_t**) ../src/
#21 0x53a4ae in main /master/
#22 0x7fcfaa2abf32 in __libc_start_main (/lib64/
#23 0x40302d in _start (/master/
0x61900004b580 is located 0 bytes inside of 956-byte region [0x61900004b580 ,0x61900004b93c ) build/debug/ kicad/kicad+ 0x51d65f) c++/9/ext/ new_allocator. h:128:19 c++/9/bits/ alloc_traits. h:470:9 c++/9/bits/ basic_string. h:237:34 c++/9/bits/ basic_string. h:232:4 c++/9/bits/ basic_string. h:658:9 wx/string. h:393:24 wx/scopedarray. h:29:24 :Add(wxString const&, unsigned long) ../src/ common/ arrstr. cpp:302: 53
freed by thread T0 here:
#0 0x51d65f in operator delete(void*) (/master/
#1 0x7fcfab24b138 /usr/include/
#2 0x7fcfab24b138 /usr/include/
#3 0x7fcfab24b138 /usr/include/
#4 0x7fcfab24b138 /usr/include/
#5 0x7fcfab24b138 /usr/include/
#6 0x7fcfab24b138 ../include/
#7 0x7fcfab24b138 ../include/
#8 0x7fcfab24b138 in wxArrayString:
previously allocated by thread T0 here: build/debug/ kicad/kicad+ 0x51c83f) :new_alloc. ..
#0 0x51c83f in operator new(unsigned long) (/master/
#1 0x52575e in __gnu_cxx: