diff --git a/ipykernel/eventloops.py b/ipykernel/eventloops.py index 1f7f47f3e..eade2d457 100644 --- a/ipykernel/eventloops.py +++ b/ipykernel/eventloops.py @@ -39,6 +39,7 @@ def process_stream_events(): fd = stream.getsockopt(zmq.FD) notifier = QtCore.QSocketNotifier(fd, QtCore.QSocketNotifier.Read, kernel.app) notifier.activated.connect(process_stream_events) + notifier.activated.connect(notifier.deleteLater) # there may already be unprocessed events waiting. # these events will not wake zmq's edge-triggered FD # since edge-triggered notification only occurs on new i/o activity. @@ -49,6 +50,7 @@ def process_stream_events(): timer = QtCore.QTimer(kernel.app) timer.setSingleShot(True) timer.timeout.connect(process_stream_events) + timer.timeout.connect(timer.deleteLater) timer.start(0) # mapping of keys to loop functions