fix(Widgets): release owned picking resources on deletion - #3620
Open
PaulHax wants to merge 1 commit into
Open
Conversation
PaulHax
marked this pull request as ready for review
August 28, 2026 21:33
PaulHax
force-pushed
the
widget-picking-teardown
branch
from
August 30, 2026 17:20
310bdc7 to
66cc77f
Compare
PaulHax
force-pushed
the
widget-picking-teardown
branch
from
August 30, 2026 20:59
66cc77f to
e8103b6
Compare
3 tasks
vtkWidgetManager owns its per-view widgets and its hardware selector, and deletion left both alive. The selector holds a full-window framebuffer, color texture and depth renderbuffer per view, and a focused widget keeps an animation request on the interactor that only losing focus cancels. On delete, release focus, remove the view widgets, and delete the selector once any in-flight capture settles. vtkOpenGLHardwareSelector chains releaseGraphicsResources into delete so its framebuffer goes with it. setRenderer drops the captured buffers and the in-flight capture that belong to the previous wiring, and a capture that settles after the manager was deleted or re-targeted no longer publishes stale buffers. Selection handles a capture that produced nothing to select against. Tests cover teardown, renderer replacement and focused-widget deletion through the public API, counting live WebGL objects.
PaulHax
force-pushed
the
widget-picking-teardown
branch
from
August 30, 2026 22:48
e8103b6 to
9b322e5
Compare
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.
Context
vtkWidgetManagerowns its per-view widgets and its hardware selector, anddelete()left both alive. The selector holds a full-window framebuffer, color texture and depth renderbuffer per view; a focused widget keeps an animation request on the interactor that only losing focus cancels, so a deleted manager could pin the requestAnimationFrame loop forever.Results
Deleting a widget manager, including mid-capture or while a widget has focus, returns the live WebGL object count to baseline, stops the focused widget's animation request, and no longer lets a stale capture serve selections.
setRendererfrees the selector built for the previous wiring instead of leaking it.Changes
vtkWidgetManager.delete()releases focus, removes the view widgets, and deletes the selector once any in-flight capture settles. Losing focus re-enables picking, so deletion also suppresses the capture thatrenderWidgetswould otherwise start on the way out.vtkOpenGLHardwareSelectorchainsreleaseGraphicsResources()intodelete()so its framebuffer goes with it.setRendererdrops the captured buffers and in-flight capture belonging to the previous wiring; a capture that settles after the manager was deleted or re-targeted no longer publishes stale buffers (previously an in-flight capture for renderer A could serve selections after a switch to renderer B).setRendererwith the same renderer intentionally remains a full re-wire: it re-reads camera/interactor/view off the renderer and rebuilds the selector.getSelectedDataForXYhandles a capture that produced nothing to select against (selector bailed on a half-torn-down view) instead of throwing from the mousemove chain.PR and Code Checklist
npm run reformatto have correctly formatted code