X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fmonoapplication.cpp;fp=src%2Fqtui%2Fmonoapplication.cpp;h=c9695cc83f87d98659feda1a8bcf30cba94f99bb;hp=f6e75a24d454a7e8d2c9e2e15d6a8fdc55163412;hb=72473527f99cbe68dcfcb4ca17f828bd3775bba7;hpb=ee3e3d298a1208d06e3a35a8aea6bcc42ce3aa5c diff --git a/src/qtui/monoapplication.cpp b/src/qtui/monoapplication.cpp index f6e75a24..c9695cc8 100644 --- a/src/qtui/monoapplication.cpp +++ b/src/qtui/monoapplication.cpp @@ -53,12 +53,25 @@ void MonolithicApplication::init() } -MonolithicApplication::~MonolithicApplication() +Quassel::QuitHandler MonolithicApplication::quitHandler() { - // Client needs to be destroyed first - Client::destroy(); - _coreThread.quit(); - _coreThread.wait(); + return [this]() { + connect(_client.get(), SIGNAL(destroyed()), this, SLOT(onClientDestroyed())); + _client.release()->deleteLater(); + }; +} + + +void MonolithicApplication::onClientDestroyed() +{ + if (_core) { + connect(_core, SIGNAL(destroyed()), QCoreApplication::instance(), SLOT(quit())); + _coreThread.quit(); + _coreThread.wait(); + } + else { + QCoreApplication::quit(); + } }