Skip to content

Keep event annotations attached to their node across tree mutations#7538

Open
Goober5000 wants to merge 1 commit into
scp-fs2open:pr_26_0_1from
Goober5000:fix/annotations
Open

Keep event annotations attached to their node across tree mutations#7538
Goober5000 wants to merge 1 commit into
scp-fs2open:pr_26_0_1from
Goober5000:fix/annotations

Conversation

@Goober5000

@Goober5000 Goober5000 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Event annotations cache the tree item they point to as a handle (HTREEITEM in FRED, QTreeWidgetItem* in qtFRED). The handle was silently invalidated whenever the tree control deleted-and-recreated an item, so annotations got decoupled.

Fix: notify when a node's handle changes. move_branch reports old->new, and free_node2 / the root-delete path report old->null (deleted). The event tree remaps the annotation's handle to follow a move, or clears it on delete (the path is left intact, so a cleared annotation is dropped at save but survives a Cancel).

In draft for now as this involves changes to sexp_tree.

@Goober5000 Goober5000 added the fix A fix for bugs, not-a-bugs, and/or regressions. label Jun 19, 2026
Event annotations cache the tree item they point to as a handle (HTREEITEM in
FRED, QTreeWidgetItem* in qtFRED). The handle was silently invalidated whenever
the tree control deleted-and-recreated an item, so annotations got decoupled.

Fix: notify when a node's handle changes. move_branch reports old->new, and
free_node2 / the root-delete path report old->null (deleted). The event tree
remaps the annotation's handle to follow a move, or clears it on delete (the path
is left intact, so a cleared annotation is dropped at save but survives a Cancel).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wookieejedi wookieejedi added the Point Release Candidate An already merged bugfix that may be merged into a previous stable version label Jul 5, 2026
@wookieejedi wookieejedi added this to the 26.0.1 milestone Jul 6, 2026
@Goober5000

Goober5000 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

This can be added as a 26.0.1 PR, but the SEXP tree refactor means that it'll have to be rebased and reworked for post-26.0. To preserve both options, I'll open a parallel PR. Ideally, this PR should be targeted to merge to the 26_0_1 branch (whenever we create it) instead of master.

@Goober5000

Copy link
Copy Markdown
Contributor Author

Post-26.0 PR created as #7595; this PR can be merged to a 26.01 branch if we make one.

@Goober5000 Goober5000 changed the base branch from master to pr_26_0_1 July 12, 2026 04:32

@JohnAFernandez JohnAFernandez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work without the unrelated changes to atan and the changes to the workflow?

@JohnAFernandez

Copy link
Copy Markdown
Contributor

Hold on, I think the the point release branch is missing two PRs.

@Goober5000

Copy link
Copy Markdown
Contributor Author

Does this work without the unrelated changes to atan and the changes to the workflow?

The event annotation fix should be independent of both.

@JohnAFernandez

Copy link
Copy Markdown
Contributor

Ok, pr_26_0_1 has been correctly rebased and the unrelated changes are not appearing on the PR anymore.

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

Labels

fix A fix for bugs, not-a-bugs, and/or regressions. Point Release Candidate An already merged bugfix that may be merged into a previous stable version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants