Skip to content

[gui] [pad] fix text insert via tool button - #24032

Open
linev wants to merge 2 commits into
root-project:masterfrom
linev:text_tool_button
Open

linev wants to merge 2 commits into
root-project:masterfrom
linev:text_tool_button

Conversation

@linev

@linev linev commented Nov 6, 2026

Copy link
Copy Markdown
Member

When TLatex tool button was clicked before,
any following mouse click on the pad insert new TLatex object
keeping previous one with empty text. As a result - after many clicks
dozens of dummy TLatex object were remain in the pad (just try gPad->ls())
Plus static fgText pointer used in TCreatePrimitives can store invalid pointer
and may lead to ROOT crash.

Therefore rewrite TCreatePrimitives::Text() functionality using
TPad::Interactive() features. Like with objects dragging add temporary
TTextEditInteractive instance which holds pointer on TLatex. Any keyboard
press will be handled only when interactive object exists.

Also avoid create multiple TLatex by multiple mouse clicking on pad.
If latex was created, then second click will just finish editing of this latex object.

linev added 2 commits November 6, 2026 14:19
kEditor was exists before, but not supported in TROOT::SetEditorMode
When TLatex tool button was clicked before,
any following mouse click on the pad insert new TLatex object
keeping previous one with empty text. As a result - after many clicks
dozens of dummy TLatex object were remain in the pad (just try gPad->ls())
Plus static fgText pointer used in TCreatePrimitives can store invalid pointer
and may lead to ROOT crash.

Therefore rewrite TCreatePrimitives::Text() functionality using
`TPad::Interactive()` features. Like with objects dragging add temporary
`TTextEditInteractive` instance which holds pointer on TLatex. Any keyboard
press will be handled only when interactive object exists.

Also avoid create multiple `TLatex` by multiple mouse clicking on pad.
If latex was created, then second click will just finish editing of this latex object.
@linev
linev requested review from bellenot and removed request for dpiparo and pcanal November 6, 2026 13:22
@linev linev self-assigned this Nov 6, 2026
Comment thread graf2d/gpad/src/TCreatePrimitives.cxx Resolved
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 15h 22m 30s ⏱️
 3 881 tests  3 880 ✅ 0 💤 1 ❌
75 991 runs  75 990 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 85880db.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants