Repository navigation
Conversation
echoix
force-pushed
the
region-manager-nested
branch
from
October 28, 2026 20:01
83a98bd to
6f2a52c
Compare
RegionManager.deactivate() removed the region it saved only when no WIND_OVERRIDE was set before activation. In a nested RegionManager the inner one found the region of the outer one, restored it, and left its own region in the mapset. Remove the saved region in both cases, like MaskManager does with its mask. Add tests that the region saved by a RegionManager is removed, also when RegionManagers are nested. Found by checking whether the tests detect the removal of the g.remove call, using mutation testing and AI assistance.
echoix
force-pushed
the
region-manager-nested
branch
from
October 30, 2026 02:25
6f2a52c to
7901d86
Compare
Check whether a region exists with g.findfile instead of searching the list of regions for a name prefix. Also check that both nested regions exist before they are removed.
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.
Description
RegionManager.deactivate()removed the region it saved only when noWIND_OVERRIDEwas set before activation, because theg.removecall was in theelsebranch. A nestedRegionManagerfound the region of the outer one, restored it, and left its own region in the mapset. The region is now removed in both cases, likeMaskManagerdoes with its mask.Two tests are added: the region saved by a
RegionManageris removed, also whenRegionManagers are nested.Motivation and context
Deleting the
g.removecall did not make any existing test fail, which showed that nothing checked the removal. A test for it found the leak with nesting.How has this been tested?
The new tests pass, and
test_region_manager_nested_removes_temporary_regionsfails without the fix. Ruff check and format pass for the changed files.Types of changes
Checklist
pre-defined prefixes
of this project.
The tests were written with AI assistance, and the expected values were checked against the behavior of the code.