Skip to content

mrviewerpy: macOS atexit handler must not touch a viewer it did not launch - #6969

Merged
Fedr merged 1 commit into
masterfrom
mrviewerpy-atexit-own-launch
Sep 29, 2026
Merged

Fedr merged 1 commit into
masterfrom
mrviewerpy-atexit-own-launch

Conversation

@Fedr

@Fedr Fedr commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Fixes a crash at exit on macOS, introduced by #6864, in applications embedding Python (e.g. MeshInspector's UI tests crashed with SIGSEGV on Intel and SIGABRT on Apple Silicon when closing).

mrviewerpy registers shutViewerAtExit with atexit. On macOS it called postLaunchDefaultViewer( *gLaunchParams, *gLaunchSetup ) whenever the viewer was pre-launched. But gLaunchParams and gLaunchSetup are set only by mrviewerpy.launch(). When the viewer was launched by the application itself, they are null, and the embedded interpreter is finalized from a plugin's shutdown() inside Viewer::launchShut(), while the viewer is still pre-launched. So the handler dereferenced null pointers.

Now the handler does nothing if the viewer was not launched by this module. Windows and Linux were not affected: there the handler already returns when gViewerFinished is not set.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Fedr
Fedr merged commit 59379aa into master Sep 29, 2026
31 checks passed
@Fedr
Fedr deleted the mrviewerpy-atexit-own-launch branch September 29, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants