eeschema: repeat action can cause sheet recursion
Description
I managed to trigger a crash using repeat action, where eeschema decided the action to repeat was inserting an instance of a sheet into itself. I'm not sure why that eeschema decided that was the action to repeat at that moment, but the easiest way to repro the crash half is to do it intentionally.
Steps to reproduce
- Start an empty project
- Create a subsheet
- In the root page, copy-paste or ctrl-d the subsheet to make a second instance.
- Go into the sub-sheet.
- Use the repeat action command.
- eeschema will pop up a dialog that the sheet changes can't be made due to potential recursion. OK the dialog.
- The "sheet properties" dialog will pop up, with no sheetfile. Cancel the dialog.
- Use the repeat action command again.
- BOOM
KiCad Version
Application: KiCad Schematic Editor x86_64 on x86_64
Version: 8.0.3-68-gf6a8ffe47e, release build
Libraries:
wxWidgets 3.2.4
FreeType 2.11.1
HarfBuzz 2.7.4
FontConfig 2.13.1
libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.17
Platform: Ubuntu 22.04.4 LTS, 64 bit, Little endian, wxGTK, X11, xubuntu, x11
OpenGL: Intel, Mesa Intel(R) Graphics (RPL-P), 4.6 (Compatibility Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2
Build Info:
Date: Jun 12 2024 11:07:39
wxWidgets: 3.2.4 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.74.0
OCC: 7.6.3
Curl: 7.81.0
ngspice: 36
Compiler: GCC 11.4.0 with C++ ABI 1016
Build settings: