Skip to content

Commit 6ec7128

Browse files
committed
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.
1 parent 2230b7c commit 6ec7128

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Orange/widgets/utils/overlay.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
QWidget, QPixmap, QStyleOption, QPainter
1919
)
2020
from PyQt4.QtCore import Qt, QSize, QRect, QPoint, QEvent, QTimer
21-
from PyQt4.QtCore import pyqtSignal as Signal
21+
from PyQt4.QtCore import pyqtSignal as Signal, pyqtSlot as Slot
2222

2323

2424
class OverlayWidget(QWidget):
@@ -172,6 +172,7 @@ def getsize(hint, minimum, maximum, policy):
172172
geom = QRect(QPoint(x, y), size)
173173
self.setGeometry(geom)
174174

175+
@Slot()
175176
def __on_destroyed(self):
176177
self.__widget = None
177178
if self.isVisible():

0 commit comments

Comments
 (0)