Fix disconnecting from objreg for deleted objects.

This commit is contained in:
Florian Bruhin 2014-11-12 20:22:49 +01:00
parent 2419071b0f
commit 4c8ecbb40d

View File

@ -96,7 +96,12 @@ class ObjectRegistry(collections.UserDict):
"""Disconnect the destroyed slot if it was connected."""
if name in self._partial_objs:
func = self._partial_objs[name]
self[name].destroyed.disconnect(func)
try:
self[name].destroyed.disconnect(func)
except RuntimeError:
# if C++ has deleted the object, the slot is already
# disconnected.
pass
del self._partial_objs[name]
def on_destroyed(self, name):