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:
Florian Bruhin 2014-11-14 18:55:48 +01:00
parent f48dd29d49
commit 9bf776aee1

View File

@ -98,9 +98,13 @@ class ObjectRegistry(collections.UserDict):
func = self._partial_objs[name]
try:
self[name].destroyed.disconnect(func)
except RuntimeError:
# if C++ has deleted the object, the slot is already
except (RuntimeError, TypeError):
# If C++ has deleted the object, the slot is already
# 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
del self._partial_objs[name]