Skip to content

[6.40] [gpad] Fix crash in streaming web canvas after TColor::DefinedColors(1)#22609

Merged
guitargeek merged 1 commit into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_22603
Jun 15, 2026
Merged

[6.40] [gpad] Fix crash in streaming web canvas after TColor::DefinedColors(1)#22609
guitargeek merged 1 commit into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_22603

Conversation

@root-project-bot

Copy link
Copy Markdown

Backport of #22603, requested by @guitargeek.

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)
@github-actions

Copy link
Copy Markdown

Test Results

    21 files      21 suites   3d 7h 10m 34s ⏱️
 3 861 tests  3 829 ✅ 0 💤 32 ❌
72 746 runs  72 707 ✅ 7 💤 32 ❌

For more details on these failures, see this check.

Results for commit 9f3e6b5.

@guitargeek guitargeek merged commit c1536ed into root-project:v6-40-00-patches Jun 15, 2026
29 of 33 checks passed
@dpiparo dpiparo deleted the BP_6.40_pull_22603 branch June 15, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants