xiaoyifang / goldendict-ng

The Next Generation GoldenDict
https://xiaoyifang.github.io/goldendict-ng/
Other
1.46k stars 78 forks source link

Did not save the history and app config when not normally exit. #1531

Open dc-me opened 1 month ago

dc-me commented 1 month ago

Describe the bug The default is close to system tray, and if you do a restart the history and app config is not saved, I haven't tried power off. this happens on all linux I think whether is flatpak or rpm or deb. There should be some way of doing this maybe every time close to system try do a save, or listening on before app kill to do the save.

To Reproduce Open app, change some app config, do a system restart, when system up the app config back to previous, it did not save the config.

Affected Dictionaries

Expected behavior More robost logic to handle the save of config and history.

Screenshots

OS and software versions

Goldendict-ng 24.05.05.ecd1138 at 2024-05-23T04:23:07Z Qt 6.7.1 GCC 13.2.0 org.kde.Platform linux 6.8.8-300.fc40.x86_64 x86_64-little_endian-lp64 Flags: MAKE_ZIM_SUPPORT USE_ICONV MAKE_CHINESE_CONVERSION_SUPPORT

Additional context

Platform Context
Windows Upload the dmp file in the crash folder located in the configuration folder (can be opened through the menu help->configuration folder) to here
Macos upload the crashpad crash log
Linux gdb backtrace info
shenlebantongying commented 1 month ago

Duplicate of #1375

The root problem is that we don't have code that handles SIGTERM (and probably SIGKILL) yet.

Qt's aboutToQuit doesn't install SIGTERM handler, so it is unrelated.

It is not that simple because Qt methods cannot be called from signal handler.

Someone needs to read this page, then put together related code. https://doc.qt.io/qt-6/unix-signals.html

Or directly copy code from KDE