diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 7087fd9e7..07488d7ed 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -498,6 +498,11 @@ class Application(QApplication): log.destroy.exception("Error while getting objects") objects = "" + try: + objreg.get('ipc-server').ignored = True + except Exception: + log.destroy.exception("Error while ignoring ipc") + try: self.lastWindowClosed.disconnect(self.shutdown) except TypeError: diff --git a/qutebrowser/utils/ipc.py b/qutebrowser/utils/ipc.py index ccf6ae0d6..8b49fe937 100644 --- a/qutebrowser/utils/ipc.py +++ b/qutebrowser/utils/ipc.py @@ -46,6 +46,7 @@ class IPCServer(QObject): """IPC server to which clients connect to. Attributes: + ignored: Whether requests are ignored (in exception hook). _timer: A timer to handle timeouts. _server: A QLocalServer to accept new connections. _socket: The QLocalSocket we're currently connected to. @@ -54,6 +55,7 @@ class IPCServer(QObject): def __init__(self, parent=None): """Start the IPC server and listen to commands.""" super().__init__(parent) + self.ignored = False self._remove_server() self._timer = usertypes.Timer(self, 'ipc-timeout') self._timer.setInterval(READ_TIMEOUT) @@ -86,6 +88,8 @@ class IPCServer(QObject): @pyqtSlot() def handle_connection(self): """Handle a new connection to the server.""" + if self.ignored: + return if self._socket is not None: log.ipc.debug("Got new connection but ignoring it because we're " "still handling another one.")