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.
This commit is contained in:
Youness Alaoui 2019-02-21 00:32:20 -05:00 committed by Curtis Gedak
parent c7605b5819
commit 4a9937f041

View file

@ -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