r.soillossbare: restore the user's region with a temporary region#1742
Open
Valyrian-Code wants to merge 3 commits into
Open
r.soillossbare: restore the user's region with a temporary region#1742Valyrian-Code wants to merge 3 commits into
Valyrian-Code wants to merge 3 commits into
Conversation
r.soillossbare set the computational region to its own working resolution via "g.region -a res=..." but never restored it, so after the module ran the user was left with their region resolution silently changed. Use gs.use_temp_region() so the original region is restored automatically on exit, including on error. Add a testsuite that fails without the fix (the region is left at the module's resolution) and passes with it.
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.
Part of #1741.
r.soillossbare sets the computational region to its own working resolution (
g.region -a res=...) as the first thing it does, but it never restores it, so after the module runs the user is left with their region silently changed.This wraps the change in
gs.use_temp_region(), which restores the user's original region automatically on exit (including on error). This is the standard GRASS pattern for modules that set their own region.I also added a testsuite. It fails without the fix (the region is left at the module's resolution) and passes with it. Verified locally on GRASS 8.5.
This is the first example from the #1741 cleanup. Happy to work through the rest at whatever pace suits, coordinating with each addon's author.