ipc: Delay deleting of QLocalSocket on disconnect
Fixes #2396. See https://bugreports.qt.io/browse/QTBUG-59297 and https://github.com/qutebrowser/qutebrowser/issues/2321#issuecomment-284024213
This commit is contained in:
parent
550514c20b
commit
e81edc8224
@ -27,7 +27,7 @@ import getpass
|
|||||||
import binascii
|
import binascii
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, Qt
|
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, Qt, QTimer
|
||||||
from PyQt5.QtNetwork import QLocalSocket, QLocalServer, QAbstractSocket
|
from PyQt5.QtNetwork import QLocalSocket, QLocalServer, QAbstractSocket
|
||||||
|
|
||||||
import qutebrowser
|
import qutebrowser
|
||||||
@ -281,7 +281,11 @@ class IPCServer(QObject):
|
|||||||
if self._socket is None:
|
if self._socket is None:
|
||||||
log.ipc.debug("In on_disconnected with None socket!")
|
log.ipc.debug("In on_disconnected with None socket!")
|
||||||
else:
|
else:
|
||||||
self._socket.deleteLater()
|
# For some reason Qt can still get delayed canReadNotifications
|
||||||
|
# internally, so if we call deleteLater() right away and then call
|
||||||
|
# QApplication::processEvents() somewhere in the code, we can get a
|
||||||
|
# segfault.
|
||||||
|
QTimer.singleShot(500, self._socket.deleteLater)
|
||||||
self._socket = None
|
self._socket = None
|
||||||
# Maybe another connection is waiting.
|
# Maybe another connection is waiting.
|
||||||
self.handle_connection()
|
self.handle_connection()
|
||||||
|
Loading…
Reference in New Issue
Block a user