On Friday 24 May 2024 13:25:37 GMT-3 Turtle Creek Software wrote: > >> Install a terminate handler instead. > > Is there some way to get from there back to the event loop?
No and you don't want to. The moment you let the exception escape back to the Qt event loop, YOU MUST QUIT. So it doesn't matter where you quit it from, so long as you do so right now. Doing so from the terminate handler means you have a much better chance of having a valid state of everything you need to log stuff and save any files that you can still try to. Trying to go through the exception-unsafe code in Qt and, worse, the third party and system libraries, is a worse outcome. The application may crash before that, with a second exception being thrown, or just plain crash. > If so, that > would solve our problem. If not, there's nothing we can do safely in a > handler. Doing a database commit would cause worse chaos if there are > unfinished records. It needs GUI code to check that. I understand, but it's too late. My point is that you've let an untestable and unexpected condition happen, so you should not trust the GUI. You may want to try and save the state of what you would commit to the database, terminate the application and restart it. The newly-started process can inspect the saved state and decide how to continue, possibly offering the user the chance to decide to keep or not. -- Thiago Macieira - thiago.macieira (AT) intel.com Principal Engineer - Intel DCAI Fleet Engineering and Quality
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest