8000 Swallow RuntimeError in __del__. · matplotlib/matplotlib@5eb7b21 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5eb7b21

Browse files
committed
Swallow RuntimeError in __del__.
This likely indicates that the underlying C++ object has been deleted and therefore the clean-up code is unnecessary.
1 parent 28514ca commit 5eb7b21

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/matplotlib/backends/backend_qt4.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,13 @@ def __init__(self, *args, **kwargs):
102102

103103
def __del__(self):
104104
# Probably not necessary in practice, but is good behavior to disconnect
105-
TimerBase.__del__(self)
106-
QtCore.QObject.disconnect(self._timer , QtCore.SIGNAL('timeout()'),
107-
self._on_timer)
105+
try:
106+
TimerBase.__del__(self)
107+
QtCore.QObject.disconnect(self._timer,
108+
QtCore.SIGNAL('timeout()'), self._on_timer)
109+
except RuntimeError:
110+
# Timer C++ object already deleted
111+
pass
108112

109113
def _timer_set_single_shot(self):
110114
self._timer.setSingleShot(self._single)

0 commit comments

Comments
 (0)
0