Skip to content

Commit 49381a5

Browse files
committed
FIX/WIP: the input to the signal handler can be None?
Depending on order of operations the notifier can be cleared before the callback is executed. Not really clear on how this can be, but seeing this happen locally.
1 parent c578ec6 commit 49381a5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/matplotlib/backends/backend_qt.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,11 @@ def _may_clear_sock():
175175
return sn
176176

177177
def handle_sigint(sn):
178-
sn.deleteLater()
179-
QtCore.QCoreApplication.sendPostedEvents(sn, QtCore.QEvent.Type.DeferredDelete)
178+
if sn is not None:
179+
sn.deleteLater()
180+
QtCore.QCoreApplication.sendPostedEvents(
181+
sn, QtCore.QEvent.Type.DeferredDelete
182+
)
180183
if hasattr(qapp_or_eventloop, 'closeAllWindows'):
181184
qapp_or_eventloop.closeAllWindows()
182185
qapp_or_eventloop.quit()

0 commit comments

Comments
 (0)