Repository navigation
Conversation
Viewer::launch always returned EXIT_SUCCESS after the event loop, so an application that wants to exit with an error code had to call std::exit while the viewer, plugins and helper threads were still alive, which runs static destructors under them and crashes. setExitCode() stores the code and launch returns it after launchShut; launchDefaultViewer passes it on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
Viewer::setExitCode( int )andgetExitCode().Viewer::launchnow returns the stored code (default0) instead of alwaysEXIT_SUCCESSafter the event loop andlaunchShut.launchDefaultVieweralready passeslaunch's result on, somainreturns it.Why. An application built on the viewer that needs to exit with an error code, e.g. after a failing command-line script, had no way to do so through the normal shutdown. It had to call
std::exit( code )from inside the event loop. That runs static destructors andatexithandlers while the viewer, the plugins, an embedded Python interpreter and helper threads (SpaceMouse listener, web requests) are still alive, and the process aborts (Crash signal: 6, then11) instead of returning the code. With this change the application callssetExitCode( code )andstopEventLoop(), and the viewer shuts down normally.No behavior change for existing callers: the default stays
0.🤖 Generated with Claude Code