X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fmonoapplication.cpp;h=34890edc5bf1ed91720e504c9770c64bfe9ffb2d;hb=4e88f2c1bcce0c4ebb7e8901cc382513266dea56;hp=f6e75a24d454a7e8d2c9e2e15d6a8fdc55163412;hpb=493043890c74e4679bb3fdaf512a0e1e52c426d3;p=quassel.git diff --git a/src/qtui/monoapplication.cpp b/src/qtui/monoapplication.cpp index f6e75a24..34890edc 100644 --- a/src/qtui/monoapplication.cpp +++ b/src/qtui/monoapplication.cpp @@ -23,6 +23,7 @@ #include "client.h" #include "core.h" #include "internalpeer.h" +#include "logmessage.h" #include "qtui.h" class InternalPeer; @@ -30,10 +31,6 @@ class InternalPeer; MonolithicApplication::MonolithicApplication(int &argc, char **argv) : QtUiApplication(argc, argv) { -#if defined(HAVE_KDE4) || defined(Q_OS_MAC) - Quassel::disableCrashHandler(); -#endif /* HAVE_KDE4 || Q_OS_MAC */ - Quassel::setRunMode(Quassel::Monolithic); } @@ -53,12 +50,38 @@ void MonolithicApplication::init() } -MonolithicApplication::~MonolithicApplication() +Quassel::QuitHandler MonolithicApplication::quitHandler() +{ + return [this]() { + quInfo() << "Client shutting down..."; + connect(_client.get(), SIGNAL(destroyed()), this, SLOT(onClientDestroyed())); + _client.release()->deleteLater(); + }; +} + + +void MonolithicApplication::onClientDestroyed() { - // Client needs to be destroyed first - Client::destroy(); - _coreThread.quit(); - _coreThread.wait(); + if (_core) { + connect(_core, SIGNAL(shutdownComplete()), this, SLOT(onCoreShutdown())); + _core->shutdown(); + } + else { + QCoreApplication::quit(); + } +} + + +void MonolithicApplication::onCoreShutdown() +{ + if (_core) { + connect(_core, SIGNAL(destroyed()), QCoreApplication::instance(), SLOT(quit())); + _coreThread.quit(); + _coreThread.wait(); + } + else { + QCoreApplication::quit(); + } }