Fix: Allow wrapped GraphicsLayoutWidget to be deleted before its wrapping Python object (#1022)
This commit is contained in:
parent
ff30a82298
commit
31f1ae586b
@ -399,9 +399,12 @@ class GraphicsView(QtGui.QGraphicsView):
|
|||||||
ev.ignore() ## not sure why, but for some reason this class likes to consume drag events
|
ev.ignore() ## not sure why, but for some reason this class likes to consume drag events
|
||||||
|
|
||||||
def _del(self):
|
def _del(self):
|
||||||
|
try:
|
||||||
if self.parentWidget() is None and self.isVisible():
|
if self.parentWidget() is None and self.isVisible():
|
||||||
msg = "Visible window deleted. To prevent this, store a reference to the window object."
|
msg = "Visible window deleted. To prevent this, store a reference to the window object."
|
||||||
warnings.warn(msg, RuntimeWarning, stacklevel=2)
|
warnings.warn(msg, RuntimeWarning, stacklevel=2)
|
||||||
|
except RuntimeError:
|
||||||
|
pass
|
||||||
|
|
||||||
if sys.version_info[0] == 3 and sys.version_info[1] >= 4:
|
if sys.version_info[0] == 3 and sys.version_info[1] >= 4:
|
||||||
GraphicsView.__del__ = GraphicsView._del
|
GraphicsView.__del__ = GraphicsView._del
|
||||||
|
Loading…
Reference in New Issue
Block a user