Garbage collect cloned frames on close

This commit is contained in:
Emanuele 2021-06-01 15:21:38 +02:00
parent 462d7deeb3
commit bc7882fda9

View file

@ -41,7 +41,7 @@ class rMViewApp(QApplication):
pen_size = 15
trail = None # None: disabled, False: inactive, True: active
cloned_frames = []
cloned_frames = set()
def __init__(self, args):
super(rMViewApp, self).__init__(args)
@ -425,10 +425,12 @@ class rMViewApp(QApplication):
img = QPixmap.fromImage(img)
img.detach()
v = QtImageViewer()
v.setAttribute(Qt.WA_DeleteOnClose)
v.setImage(img)
v.show()
v.rotate(self.viewer._rotation)
self.cloned_frames.append(v)
self.cloned_frames.add(v)
v.destroyed.connect(lambda: self.cloned_frames.discard(v))
@pyqtSlot()
def toggleStreaming(self):