Fix GR text-state corruption causing persistent layout assertion failures#5736
Open
AJ0070 wants to merge 4 commits intoJuliaPlots:v2from
Open
Fix GR text-state corruption causing persistent layout assertion failures#5736AJ0070 wants to merge 4 commits intoJuliaPlots:v2from
AJ0070 wants to merge 4 commits intoJuliaPlots:v2from
Conversation
Author
|
The code block mentioned in the issue description works fine locally but there is failure on CI. I am trying to figure it out. It would be great if someone could help out. |
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.
Fixes a GR backend state-corruption bug behind issue #4816 where plotting with non-finite text coordinates/extents could poison subsequent plots in the same session and trigger layout assertions (
total_plotarea_vertical > 0mm/total_plotarea_horizontal > 0mm).Root cause
When GR was asked to draw or measure text at invalid coordinates (for example,
annotate!withNaNpositions, or labels/ticks after invalid log-scale inputs), GR could return non-finite text extents (inqtext/inqtextext). Those values propagated into subplot padding and layout calculations, causing assertion failures. Because GR state persisted, later unrelated plots also failed until restart.Fix
In
GRExt.jl:gr_text(...): skip text draw when(x, y)is non-finite.gr_inqtext(...): sanitize non-finite returned text bounds and fall back to finite zero extents.This prevents non-finite values from entering layout padding math while preserving normal behavior for valid inputs.
Testing
Added regression test in
test_misc.jlcovering:Strengthened test path to renderer-level checks (
show(..., MIME("image/png"), ...)) so GR drawing and measuring is exercised directly.Additional GR stress verification in a clean environment (repeated bad → good render cycles, including
twinx) completed without reintroducing assertion failures or session poisoning.Attribution
.zenodo.jsonfor PRs against v2 or PRs against master (see How to get acknowledged #3503)Things to consider