From 4a9937f041ce56d5033f966b3d81cd05fd079b5d Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Thu, 21 Feb 2019 00:32:20 -0500 Subject: [PATCH] Do not use a lambda function in the fullScreenEditor's myScrollBar timer signal The lambda function will keep a reference to the scrollbar python object preventing it from getting destroyed when the QScrollbar is destroyed. This causes the underlying QT widget to be freed while the python object still exists, therefore the timer itself doesn't get stopped/cleaned, so the timer will get called and cause a crash with : "RuntimeError: Wrapped C/C++ object of type myScrollbar has been deleted" To reproduce, press F11 repeatedly while scrolling. --- manuskript/ui/editors/fullScreenEditor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manuskript/ui/editors/fullScreenEditor.py b/manuskript/ui/editors/fullScreenEditor.py index ff6361f..bc71715 100644 --- a/manuskript/ui/editors/fullScreenEditor.py +++ b/manuskript/ui/editors/fullScreenEditor.py @@ -312,11 +312,14 @@ class myScrollBar(QScrollBar): self.timer = QTimer() self.timer.setInterval(500) self.timer.setSingleShot(True) - self.timer.timeout.connect(lambda: self.parent().hideWidget(self)) + self.timer.timeout.connect(self.hide) self.valueChanged.connect(lambda v: self.timer.start()) self.valueChanged.connect(lambda: self.parent().showWidget(self)) self.rangeChanged.connect(self.rangeHasChanged) + def hide(self): + self.parent().hideWidget(self) + def setColor(self, color): self._color = color