From 56137c485feca04f2be6b7552757c55d7999e465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 17 Jun 2016 16:27:45 +0200 Subject: [PATCH] Nicer resetting of _loop_kicking_operator_running --- blender_cloud/async_loop.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/blender_cloud/async_loop.py b/blender_cloud/async_loop.py index 7db5f6e..a7395d4 100644 --- a/blender_cloud/async_loop.py +++ b/blender_cloud/async_loop.py @@ -94,7 +94,6 @@ def erase_async_loop(): loop = asyncio.get_event_loop() loop.stop() - _loop_kicking_operator_running = False class AsyncLoopModalOperator(bpy.types.Operator): @@ -104,6 +103,14 @@ class AsyncLoopModalOperator(bpy.types.Operator): timer = None log = logging.getLogger(__name__ + '.AsyncLoopModalOperator') + def __del__(self): + global _loop_kicking_operator_running + + # This can be required when the operator is running while Blender + # (re)loads a file. The operator then doesn't get the chance to + # finish the async tasks, hence stop_after_this_kick is never True. + _loop_kicking_operator_running = False + def execute(self, context): return self.invoke(context, None)