diff options
Diffstat (limited to 'qutebrowser/misc/quitter.py')
-rw-r--r-- | qutebrowser/misc/quitter.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/qutebrowser/misc/quitter.py b/qutebrowser/misc/quitter.py index 92764a3a4..a849aec70 100644 --- a/qutebrowser/misc/quitter.py +++ b/qutebrowser/misc/quitter.py @@ -221,21 +221,18 @@ class Quitter(QObject): status, session)) sessions.shutdown(session, last_window=last_window) - - if prompt.prompt_queue.shutdown(): - # If shutdown was called while we were asking a question, we're in - # a still sub-eventloop (which gets quit now) and not in the main - # one. - # This means we need to defer the real shutdown to when we're back - # in the real main event loop, or we'll get a segfault. - log.destroy.debug("Deferring real shutdown because question was " - "active.") - QTimer.singleShot(0, functools.partial(self._shutdown_2, status, - is_restart=is_restart)) - else: - # If we have no questions to shut down, we are already in the real - # event loop, so we can shut down immediately. - self._shutdown_2(status, is_restart=is_restart) + prompt.prompt_queue.shutdown() + + # If shutdown was called while we were asking a question, we're in + # a still sub-eventloop (which gets quit now) and not in the main + # one. + # But there's also other situations where it's problematic to shut down + # immediately (e.g. when we're just starting up). + # This means we need to defer the real shutdown to when we're back + # in the real main event loop, or we'll get a segfault. + log.destroy.debug("Deferring shutdown stage 2") + QTimer.singleShot( + 0, functools.partial(self._shutdown_2, status, is_restart=is_restart)) def _shutdown_2(self, status: int, is_restart: bool) -> None: """Second stage of shutdown.""" |