X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fquassel.cpp;h=646e8edddb2d5afe4df4924252b9f8d321594ad3;hp=9a922a6aee6724bfceed93b2a78af6808a96ac83;hb=1f2784bfa1c1ce90defa32f13c78afd72c227bfd;hpb=493043890c74e4679bb3fdaf512a0e1e52c426d3 diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index 9a922a6a..646e8edd 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -136,12 +136,17 @@ void Quassel::registerQuitHandler(QuitHandler handler) void Quassel::quit() { - if (_quitHandlers.empty()) { - QCoreApplication::quit(); - } - else { - for (auto &&handler : _quitHandlers) { - handler(); + // Protect against multiple invocations (e.g. triggered by MainWin::closeEvent()) + if (!_quitting) { + _quitting = true; + if (_quitHandlers.empty()) { + QCoreApplication::quit(); + } + else { + // Note: We expect one of the registered handlers to call QCoreApplication::quit() + for (auto &&handler : _quitHandlers) { + handler(); + } } } }