From 9bf776aee1e2e43d2432e0551599af79d3d9a81c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 14 Nov 2014 18:55:48 +0100 Subject: [PATCH] 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). --- qutebrowser/utils/objreg.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qutebrowser/utils/objreg.py b/qutebrowser/utils/objreg.py index f5305c899..d4a354448 100644 --- a/qutebrowser/utils/objreg.py +++ b/qutebrowser/utils/objreg.py @@ -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]