Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9b8a944

Browse filesBrowse files
committed
MNT: project Qt backends from recursive draws
This does not prevent the recursion, which may segfault Qt, but prevents it from infinitely recursing if Qt does not crash. Closes #9406
1 parent 6789aed commit 9b8a944
Copy full SHA for 9b8a944

File tree

Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed

‎lib/matplotlib/backends/backend_qt5agg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_qt5agg.py
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,22 @@ def draw_idle(self):
140140
QtCore.QTimer.singleShot(0, self.__draw_idle_agg)
141141

142142
def __draw_idle_agg(self, *args):
143+
# if nothing to do, bail
143144
if not self._agg_draw_pending:
144145
return
146+
# we have now tried this function at least once, do not run
147+
# again until re-armed. Doing this here rather than after
148+
# protects against recursive calls triggered through self.draw
149+
self._agg_draw_pending = False
150+
# if negative size, bail
145151
if self.height() < 0 or self.width() < 0:
146-
self._agg_draw_pending = False
147152
return
148153
try:
154+
# actually do the drawing
149155
self.draw()
150156
except Exception:
151157
# Uncaught exceptions are fatal for PyQt5, so catch them instead.
152158
traceback.print_exc()
153-
finally:
154-
self._agg_draw_pending = False
155159

156160
def blit(self, bbox=None):
157161
"""Blit the region in bbox.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.