Clicking MS Windows taskbar "Close all Windows" on an unsaved schematic and clicking 'save' twice causes the schematic to be cleared/corrupted instead of saving
What is the current behavior and what is the expected behavior?
In the below two statements, Kicad has been opened from a project (not by opening the schematic directly). That is, you must open the schematic from the project window, so you can get the "Close all Windows" option, instead of the "Close window" option.
Expected Behavior
On Windows, when right clicking Kicad on the taskbar and pressing "Close all Windows", the save dialog should correctly save your schematic files.
Actual Behavior
On Windows, right clicking Kicad on the taskbar and pressing "Close all Windows" will show the save dialog twice. If you click "Save" on the dialog twice, the saved schematic files are cleared/corrupted (they become empty).
Note that if you click "Save" on the dialog the first time, but "Discard" on the second time, it saves correctly.
The .sch-bak
file contains the schematic that should have been saved, so it looks like your schematic is still recoverable.
Steps to reproduce
- Use Windows 10
- Open the example project
- Open the schematic file from the project window (not in standalone mode)
- Modify the schematic file in any way (eg delete the resistor)
- Right click on Kicad in the taskbar, click 'Close all Windows'
- The 'save schematic' dialog will appear. Click 'save'
- The 'save schematic' dialog will appear again. You must click 'save' again to reproduce the bug.
- Kicad will close (it looks like it crashes?)
- Re-open the schematic - it will now be empty.
If there are multiple steps to reproduce it or it is a visual issue, then providing a screen recording as an attachment to this report is recommended.
Here is a video reproducing the issue: https://www.youtube.com/watch?v=RG8mycjG2EM
If this issue is specific to a project, please attach it to this issue.
I don't think the issue is specific to a project - I tested on a couple different projects and all seem to have the issue. But I've attached the minimal example below (you can use the git repo to see what files change when the bug happens.)
Minimal Example: minimal_example.zip
I also tested on two different computers and the behavior was the same.
KiCad Version
I've tested on both kicad 5.1.5 (latest release) and the latest nightly. They appear to behave the same, but I haven't tested extensively.
Release version information
Application: KiCad
Version: (5.1.5-rc1-4-g167d408b5)-1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.71.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.66.0
Compiler: GCC 9.2.0 with C++ ABI 1013
Build settings:
USE_WX_GRAPHICS_CONTEXT=OFF
USE_WX_OVERLAY=OFF
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON
Nightly version information
Application: KiCad
Version: (5.99.0-1125-ge9cd9ee8f), release build
Libraries:
wxWidgets 3.0.4
libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
Build date: Mar 19 2020 22:00:24
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.71.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.66.0
Compiler: GCC 9.2.0 with C++ ABI 1013
Build settings:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON