Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6ffa5d

Browse files
Kojoleymeeseeksmachine
authored andcommitted
Backport PR #16028: Prevent FigureCanvasQT_draw_idle recursively calling itself.
1 parent 98aceb1 commit e6ffa5d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,17 +498,16 @@ def draw_idle(self):
498498
QtCore.QTimer.singleShot(0, self._draw_idle)
499499

500500
def _draw_idle(self):
501-
if self.height() < 0 or self.width() < 0:
502-
self._draw_pending = False
503501
if not self._draw_pending:
504502
return
503+
self._draw_pending = False
504+
if self.height() < 0 or self.width() < 0:
505+
return
505506
try:
506507
self.draw()
507508
except Exception:
508509
# Uncaught exceptions are fatal for PyQt5, so catch them instead.
509510
traceback.print_exc()
510-
finally:
511-
self._draw_pending = False
512511

513512
def drawRectangle(self, rect):
514513
# Draw the zoom rectangle to the QPainter. _draw_rect_callback needs

0 commit comments

Comments
 (0)