diff --git a/quamash/__init__.py b/quamash/__init__.py index 5a357cf..cfd2ea2 100644 --- a/quamash/__init__.py +++ b/quamash/__init__.py @@ -347,10 +347,14 @@ def call_later(self, delay, callback, *args): def _add_callback(self, handle, delay=0): def upon_timeout(): + nonlocal timer + nonlocal handle assert timer in self.__timers, 'Timer {} not among {}'.format(timer, self.__timers) self.__timers.remove(timer) + timer = None self._logger.debug('Callback timer fired, calling {}'.format(handle)) handle._run() + handle = None self._logger.debug('Adding callback {} with delay {}'.format(handle, delay)) timer = QtCore.QTimer(self.__app) diff --git a/tests/test_qeventloop.py b/tests/test_qeventloop.py index 7fadb24..0b3474a 100644 --- a/tests/test_qeventloop.py +++ b/tests/test_qeventloop.py @@ -691,7 +691,7 @@ def fut_cb(fut): @pytest.mark.parametrize('use_quamash', - [pytest.mark.xfail(True, reason="bug34"), False] + [True, False] ) def test_exception_handler(use_quamash, loop): handler_called = False