From 69161a3b65b43c86968b7e5e50ceeddb13642b05 Mon Sep 17 00:00:00 2001 From: Fedor Chelnokov Date: Tue, 29 Sep 2026 16:01:25 +0300 Subject: [PATCH] mrviewerpy: atexit handler on macOS ignores a viewer it did not launch Co-Authored-By: Claude Opus 5.5 --- source/mrviewerpy/MRPythonViewer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/mrviewerpy/MRPythonViewer.cpp b/source/mrviewerpy/MRPythonViewer.cpp index f7cbdf4377d2..55ac155f76fe 100644 --- a/source/mrviewerpy/MRPythonViewer.cpp +++ b/source/mrviewerpy/MRPythonViewer.cpp @@ -381,6 +381,8 @@ void shutViewerAtExit() } gViewerFinished.wait_for( std::chrono::seconds( 10 ) ); // a stuck loop must not hold the exit forever #else + if ( !gLaunchParams ) // the viewer was not launched by this module, e.g. Python embedded in an application + return; auto& viewer = getViewerInstance(); if ( viewer.isPreLaunched() ) postLaunchDefaultViewer( *gLaunchParams, *gLaunchSetup );