add objects to registry BEFORE activating finalizer
This commit is contained in:
parent
efc157f1c1
commit
9cd3067b4b
@ -302,10 +302,10 @@ class StyleRegistry(QtCore.QObject):
|
||||
else:
|
||||
registration = next(StyleRegistry._registrationGenerator)
|
||||
obj.registration = registration # patch in attribute
|
||||
self.registered_objects[registration] = (weakref.ref(obj), desc)
|
||||
fin = weakref.finalize(obj, self.unregister, registration)
|
||||
fin.atexit = False # no need to clean up registry on program exit
|
||||
# print('registering', registration, '(',str(obj),'):',str(desc))
|
||||
self.registered_objects[registration] = (weakref.ref(obj), desc)
|
||||
|
||||
def unregister(self, registration):
|
||||
"""
|
||||
@ -314,6 +314,8 @@ class StyleRegistry(QtCore.QObject):
|
||||
# obj, desc = self.registered_objects[registration]
|
||||
# print('unregistering', registration, '(',str(obj),'):',str(desc))
|
||||
# del obj, desc
|
||||
#
|
||||
# if registration in self.registered_objects:
|
||||
del self.registered_objects[registration]
|
||||
|
||||
def colors(self):
|
||||
|
Loading…
Reference in New Issue
Block a user