Repository navigation
Refactor/back stack lifecycle - #3
Merged
Merged
Conversation
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.
Moves the back-stack protocol out of
main.cpp, replaces the globalExitManagerwith an explicit exit decision, and makes a killedoptionshand the screen back to the home menu.Changes
back_stack.{h,cpp}: pure functions forOM_BACK_STACK(MakeEntry,PopIfLast,Push,BackCommand). Output is byte-identical to the old inline code. The format is unchanged: entries separated by;, fields by,(commandPath,scriptPath,titleKey[,marker]).ApplicationLifecyclereplacesExitManager. Each exit point now callsDecide(Resume | Leave).ResumeUI.shstill runs from a static destructor, aftermain()'s locals (SDL) are released, and at most once.options(killall,S8103OptionsMenu stop) now resumes the UI and clears/tmp/options.flag. The handler only uses async-signal-safe calls (vfork+execve, then_exit).launch_save_manager.sh: on 4-field entries,title_keyused to swallow,marker. The marker is now passed on as--selectedMarker.Exit decisions
exit(1)(missing or empty commands folder)SDL_QUIT, reset buttonRESTART_UIdecides (default: Leave)DELETE_STRrelaunches)RESTART_UIkeeps its old meaning.Decideruns before thesystem()it guards, so a signal during that call does not resume over a screen another process owns.Testing
optionsbinary built natively in Docker, with anLD_PRELOADshim that recordssystem()calls and injects keys. It pins the exactOM_BACK_STACKandbackCommandstrings, the early-exitResumeUI, the external/back/delete paths, the SIGTERM/SIGHUP exit code with a single resume, command-file parsing (CRLF, comments, lines without=), and the launchers run with stubs. All pass.T→ running) and remove the flag.launch_save_manager.shruns under BusyBoxashwith 3- and 4-field entries.SDL_QUIT, but only in the main loop. SIGHUP was not handled at all.Not covered
optiondignores the exit status, so it cannot recover either.theme_manager, the gamepad tools) do not get the handler. Their vendored OptionsMenu picks upback_stackonly when they bump the submodule.launch_favorites_manager.shlives in theom-favoritesrepo and needs its own PR.