Fix crash when right-clicking twice on fullscreen panel

If you right click once on the fullscreen panel and the context menu pop up
then you right click again somewhere else on the panel *while the previous
context menu is still visible* then it will cause a crash with :
"Windows fatal exception: access violation"
It seems to be caused by a crash in the QT event loop, trying to delete the
existing QMenu within an event handler.
This commit is contained in:
Youness Alaoui 2019-02-25 16:54:28 -05:00 committed by Curtis Gedak
parent 3f217257c4
commit a6942b7923

View file

@ -359,6 +359,7 @@ class myPanel(QWidget):
self.show()
self.setAttribute(Qt.WA_TranslucentBackground)
self._autoHide = True
self._m = None
if not vertical:
self.setLayout(QHBoxLayout())
@ -379,6 +380,8 @@ class myPanel(QWidget):
def mouseReleaseEvent(self, event):
if event.button() == Qt.RightButton:
if self._m:
self._m.deleteLater()
m = QMenu()
a = QAction(self.tr("Auto-hide"), m)
a.setCheckable(True)