qtui: Fix quit sequence and lifetime issues
authorManuel Nickschas <sputnick@quassel-irc.org>
Sat, 29 Sep 2018 09:52:12 +0000 (11:52 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 1 Oct 2018 17:06:49 +0000 (19:06 +0200)
commit72473527f99cbe68dcfcb4ca17f828bd3775bba7
treee9052c6635d4fd28e8592a3f8f435b2b3fbc8e55
parentee3e3d298a1208d06e3a35a8aea6bcc42ce3aa5c
qtui: Fix quit sequence and lifetime issues

Make use of the Singleton mixin for Client and GraphicalUi. Fix
ownership and explicitly construct and destroy the pseudo singletons.
Remove some static init methods in favor of initializing in the
constructor where possible. We still need delayed initialization
of the main UI however, so GraphicalUi::init() has to stay.

Simply calling QCoreApplication::quit() doesn't clean up properly,
because it immediately stops event processing, which means that
any deferred deletions won't be processed anymore.

Since we perform some important and asynchronous tasks during
shutdown, such as saving settings and properly unregistering from
IRC, we really want proper cleanup, though.

Fix this by relying on Quassel::quit() instead, and registering
appropriate quit handlers that shut down the client in orderly
and controlled fashion. Ensure that all open windows and dialogs
are closed prior to MainWin's destruction.

Core shutdown warrants a more complex approach, which will be
implemented in a follow-up commit.
12 files changed:
src/client/client.cpp
src/client/client.h
src/qtui/mainwin.cpp
src/qtui/mainwin.h
src/qtui/monoapplication.cpp
src/qtui/monoapplication.h
src/qtui/qtui.cpp
src/qtui/qtui.h
src/qtui/qtuiapplication.cpp
src/qtui/qtuiapplication.h
src/uisupport/graphicalui.cpp
src/uisupport/graphicalui.h