From 9d46822657e046aa0fe1a9fbb12e80251091781d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 25 Jun 2024 17:50:51 +0200 Subject: [PATCH] Add-on: Job submission: always call `self._quit()` before stopping In the job submission operator, always call `self._quit()` before it stops. It's just good practice to clean up. --- addon/flamenco/operators.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addon/flamenco/operators.py b/addon/flamenco/operators.py index 6d21672d..3dd30561 100644 --- a/addon/flamenco/operators.py +++ b/addon/flamenco/operators.py @@ -139,7 +139,9 @@ class FLAMENCO_OT_submit_job(FlamencoOpMixin, bpy.types.Operator): if self.packthread is None: # If there is no pack thread running, there isn't much we can do. - return self._quit(context) + self.report({"ERROR"}, "No pack thread running, please report a bug") + self._quit(context) + return {"CANCELLED"} # Keep handling messages from the background thread. while True: @@ -152,9 +154,14 @@ class FLAMENCO_OT_submit_job(FlamencoOpMixin, bpy.types.Operator): result = self._on_bat_pack_msg(context, msg) if "RUNNING_MODAL" not in result: - return result + break + + self._quit(context) + self.packthread.join(timeout=5) + return {"FINISHED"} def invoke(self, context: bpy.types.Context, event: bpy.types.Event) -> set[str]: + filepath, ok = self._presubmit_check(context) if not ok: return {"CANCELLED"}