Great Job!
That code is there for macOS since we use multiple MainWindows at the same time. So exiting a MainWindow is not the same as exiting the entire application as it is for Linux and Windows. This helps to speed that process and keep the overall memory footprint smaller on macOS.
If that helps, then Qt 5.9.5 is very very broken as invoking all destructors on the way out has been part of C++ spec from the very very beginning. You just can not skip destructors if the app is exiting.
Perhaps the order of destructing key objects matters for some reason?
And I still do not know why or how that using WriteSettings in the call to close() did not fix this unless it is the QSettings writing itself that gets broken somehow and writing to it gets lost. And how did the call to close and its debug statement not show up?
Very strange!
Using this code should not hurt things for Windows or Linux unless order of running the destructors matters.
It does force the TOC destructor to be called before the FindReplace destructor, so maybe that is why it helps. It also forces the Preview Window to be destructed last because of early segfaults in QWebEngine that I remembered from Qt5.11.
Last edited by KevinH; 02-08-2020 at 10:27 AM.
|