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

Skip to content

Commit ed8e357

Browse files
committed
added try block to backend_gtk3.py
Added try block around `draw` in `idle_draw`. If `draw` raises an exception the figure is never marked idle again and pyplot functions will not work as expect.
1 parent 3108091 commit ed8e357

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,10 @@ def draw(self):
322322

323323
def draw_idle(self):
324324
def idle_draw(*args):
325-
self.draw()
326-
self._idle_draw_id = 0
325+
try:
326+
self.draw()
327+
finally:
328+
self._idle_draw_id = 0
327329
return False
328330
if self._idle_draw_id == 0:
329331
self._idle_draw_id = GObject.idle_add(idle_draw)

0 commit comments

Comments
 (0)