diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index 7f5d214ac1d5..f59440eff7e0 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -481,17 +481,16 @@ def draw_idle(self): QtCore.QTimer.singleShot(0, self._draw_idle) def _draw_idle(self): - if self.height() < 0 or self.width() < 0: - self._draw_pending = False if not self._draw_pending: return + self._draw_pending = False + if self.height() < 0 or self.width() < 0: + return try: self.draw() except Exception: # Uncaught exceptions are fatal for PyQt5, so catch them instead. traceback.print_exc() - finally: - self._draw_pending = False def drawRectangle(self, rect): # Draw the zoom rectangle to the QPainter. _draw_rect_callback needs