fix: re-acquire menu handle after removeItem loop to prevent segfault#81
Merged
Merged
Conversation
c39d52b to
2c8a088
Compare
There was a problem hiding this comment.
Pull request overview
Fixes a Nuke stability issue where removing all tracked items from the Nodes > Griptape menu can cause Nuke to destroy the parent menu object, leaving a stale C++ handle that can segfault on the next addCommand. The PR ensures the submenu handle is re-acquired after the removal loop.
Changes:
- Re-acquire
griptape_nodesvia a secondnodes_toolbar.addMenu('Griptape')call after theremoveItemloop in the generated menu script. - Add a unit test asserting the second
addMenu('Griptape')occurs after removals and before re-population.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/unit/test_nuke_gizmo_publisher_menu.py | Adds an ordering test to ensure the submenu handle is re-acquired after removals. |
| publish_gizmo/nuke_gizmo_publisher.py | Updates generated menu_code to re-add/re-acquire the Griptape menu handle after removing tracked items. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
39130f8 to
867037b
Compare
Closes #78. When every tracked item is removed from the Griptape (node) menu, Nuke silently destroys the parent menu object, leaving a dangling C++ pointer. The next addCommand through that stale handle triggers a segfault. Re-call addMenu after the removal loop to obtain a fresh (or still-valid) handle.
867037b to
2e217d2
Compare
collindutter
approved these changes
Jun 17, 2026
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.
Closes #78.
When every tracked item is removed from the Griptape (node) menu, Nuke silently destroys the parent menu object, leaving a dangling C++ pointer. The next addCommand through that stale handle triggers a segfault. Re-call addMenu after the removal loop to obtain a fresh (or still-valid) handle.