Fix TypeError when closing tabs with older PyQt-versions.
Fixes #257. It seems disconnecting a signal from a destroyed object gives us a "TypeError: pyqtSignal must be bound to a QObject, not 'WebView'" instead of a RuntimeError with older PyQt-versions (5.2.1).
This commit is contained in:
parent
f48dd29d49
commit
9bf776aee1
@ -98,9 +98,13 @@ class ObjectRegistry(collections.UserDict):
|
|||||||
func = self._partial_objs[name]
|
func = self._partial_objs[name]
|
||||||
try:
|
try:
|
||||||
self[name].destroyed.disconnect(func)
|
self[name].destroyed.disconnect(func)
|
||||||
except RuntimeError:
|
except (RuntimeError, TypeError):
|
||||||
# if C++ has deleted the object, the slot is already
|
# If C++ has deleted the object, the slot is already
|
||||||
# disconnected.
|
# disconnected.
|
||||||
|
#
|
||||||
|
# With older PyQt-versions (5.2.1) we'll get a "TypeError:
|
||||||
|
# pyqtSignal must be bound to a QObject" instead:
|
||||||
|
# https://github.com/The-Compiler/qutebrowser/issues/257
|
||||||
pass
|
pass
|
||||||
del self._partial_objs[name]
|
del self._partial_objs[name]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user