Try working around AttributeError in objreg
This commit is contained in:
parent
c5a363c66c
commit
f6d4e0d32c
@ -94,8 +94,15 @@ class ObjectRegistry(collections.UserDict):
|
||||
|
||||
def _disconnect_destroyed(self, name):
|
||||
"""Disconnect the destroyed slot if it was connected."""
|
||||
if name in self._partial_objs:
|
||||
func = self._partial_objs[name]
|
||||
try:
|
||||
partial_objs = self._partial_objs
|
||||
except AttributeError:
|
||||
# This sometimes seems to happen on Travis during
|
||||
# test_history.test_adding_item_during_async_read
|
||||
# and I have no idea why...
|
||||
return
|
||||
if name in partial_objs:
|
||||
func = partial_objs[name]
|
||||
try:
|
||||
self[name].destroyed.disconnect(func)
|
||||
except (RuntimeError, TypeError):
|
||||
@ -106,7 +113,7 @@ class ObjectRegistry(collections.UserDict):
|
||||
# pyqtSignal must be bound to a QObject" instead:
|
||||
# https://github.com/The-Compiler/qutebrowser/issues/257
|
||||
pass
|
||||
del self._partial_objs[name]
|
||||
del partial_objs[name]
|
||||
|
||||
def on_destroyed(self, name):
|
||||
"""Schedule removing of a destroyed QObject.
|
||||
|
Loading…
Reference in New Issue
Block a user