Skip to content

Commit 4821cd6

Browse files
committed
FIX: be more cautious about checking widget size
This can fail if the c++ side of the object has already been cleaned up but the Python side is still lingering (due to refs in callbacks). closes #29618
1 parent d3491dc commit 4821cd6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/backends/backend_qt.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,12 @@ def _draw_idle(self):
517517
if not self._draw_pending:
518518
return
519519
self._draw_pending = False
520-
if self.height() <= 0 or self.width() <= 0:
520+
try:
521+
if self.height() <= 0 or self.width() <= 0:
522+
return
523+
except RuntimeError:
524+
# This can happen if the c++ object is already cleaned up
525+
# but the Python objects are lingering
521526
return
522527
try:
523528
self.draw()

0 commit comments

Comments
 (0)