8000 Merge pull request #21530 from QuLogic/gtk-interrupt · ianhi/matplotlib@98f005c · GitHub
[go: up one dir, main page]

Skip to content

Commit 98f005c

Browse files
authored
Merge pull request matplotlib#21530 from QuLogic/gtk-interrupt
Fix interrupting GTK on plain Python
2 parents b528d5c + cf659c6 commit 98f005c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/matplotlib/backends/_backend_gtk.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ def mainloop():
169169

170170
try:
171171
_application.run() # Quits when all added windows close.
172+
except KeyboardInterrupt:
173+
# Ensure all windows can process their close event from
174+
# _shutdown_application.
175+
context = GLib.MainContext.default()
176+
while context.pending():
177+
context.iteration(True)
178+
raise
172179
finally:
173180
# Running after quit is undefined, so create a new one next time.
174181
_application = None

0 commit comments

Comments
 (0)
0