From 5887ca0117be3fb5a7e71bab1c197b4175eb5f13 Mon Sep 17 00:00:00 2001 From: Stacey Oue Date: Wed, 13 Mar 2024 14:34:21 -0400 Subject: [PATCH] SHOT-4357: Fix plugin bootstrap cleanup (#48) * Add logging information. * Make sure to get the current engine before cleanup since our reference may be stale. --- python/tk_framework_alias_utils/plugin_bootstrap.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/tk_framework_alias_utils/plugin_bootstrap.py b/python/tk_framework_alias_utils/plugin_bootstrap.py index 12e207c5..a6725e32 100644 --- a/python/tk_framework_alias_utils/plugin_bootstrap.py +++ b/python/tk_framework_alias_utils/plugin_bootstrap.py @@ -111,6 +111,7 @@ def toolkit_plugin_bootstrap( # This will block and not return until ShotGrid app exits. ret = app.exec_() + logger.info("ShotGrid QApplication exited with return code: %s" % ret) # Clean up ShotGrid components root_logger = sgtk.LogManager().root_logger @@ -120,9 +121,13 @@ def toolkit_plugin_bootstrap( if isinstance(handler, ToolkitEngineHandler): root_logger.removeHandler(handler) + # Get the engine again before clean up, our reference may be stale. + engine = sgtk.platform.current_engine() if engine: + logger.info("Destroying Toolkit...") engine.destroy() + logger.info("Plugin bootstrap exiting") return ret