[6.40] [gpad] Fix crash in streaming web canvas after TColor::DefinedColors(1)#22609
Merged
guitargeek merged 1 commit intoJun 15, 2026
Merged
Conversation
TColor::DefinedColors(1) sets the global color bookkeeping to the sticky "always store colors" mode (gLastDefinedColors = -1). When a canvas is then serialized to JSON for the web display - as JupyROOT does to show a canvas inline in a notebook - TWebCanvas::CreatePadSnapshot temporarily detaches the pad primitives (fPrimitives = nullptr) and calls the no-arg TColor::DefinedColors() to clear the change flag so the canvas streamer skips color storage. In sticky mode that call returns kTRUE early without resetting the flag, so TCanvas::Streamer entered the color-storing branch and dereferenced the null fPrimitives, crashing with a segmentation violation. Guard the color-storing branch with a null check on fPrimitives. Colors and the palette are delivered separately by TWebCanvas::AddColorsPalette in that path, and normal file saving (where fPrimitives is never null) is unaffected. Add a regression test that reproduces the original report by drawing a canvas and calling TWebCanvas::CreateCanvasJSON after TColor::DefinedColors(1); it segfaults without this fix and passes with it. The JupyROOT notebook test is registered without output comparison (it draws a canvas, so its output is not reproducible), matching Cpp_IMT_Canvas.ipynb. Closes root-project#20018. 🤖 Done with the help of [Claude Code](https://claude.com/claude-code) (Claude Opus 4.8) (cherry picked from commit 2266020)
Test Results 21 files 21 suites 3d 7h 10m 34s ⏱️ For more details on these failures, see this check. Results for commit 9f3e6b5. |
c1536ed
into
root-project:v6-40-00-patches
29 of 33 checks passed
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.
Backport of #22603, requested by @guitargeek.