Skip to content

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

Draft
Goober5000 wants to merge 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/annotations
Draft

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

Conversation

@Goober5000

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.

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.

2 participants