From d21193362a81e5694e4b12011a747ec331af2ba3 Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Mon, 4 Jul 2016 09:53:52 +0200 Subject: [PATCH] overlay: Auto disconnect when the overlay widget is deleted Register `__on_destroyed` as a Qt slot so it can be automatically disconnected when the overlay widget is deleted/destroyed. This fixes a possible 'RuntimeError C/C++ object was deleted ...' error when the overlay is deleted before the target widget. --- Orange/widgets/utils/overlay.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Orange/widgets/utils/overlay.py b/Orange/widgets/utils/overlay.py index c174c874ada..75faaabde39 100644 --- a/Orange/widgets/utils/overlay.py +++ b/Orange/widgets/utils/overlay.py @@ -18,7 +18,7 @@ QWidget, QPixmap, QStyleOption, QPainter ) from PyQt4.QtCore import Qt, QSize, QRect, QPoint, QEvent, QTimer -from PyQt4.QtCore import pyqtSignal as Signal +from PyQt4.QtCore import pyqtSignal as Signal, pyqtSlot as Slot class OverlayWidget(QWidget): @@ -172,6 +172,7 @@ def getsize(hint, minimum, maximum, policy): geom = QRect(QPoint(x, y), size) self.setGeometry(geom) + @Slot() def __on_destroyed(self): self.__widget = None if self.isVisible():