Skip to content

fix: re-acquire menu handle after removeItem loop to prevent segfault#81

Merged
feltech merged 1 commit into
mainfrom
fix/issue-78-gizmo-menu-refresh-segfault
Jun 17, 2026
Merged

fix: re-acquire menu handle after removeItem loop to prevent segfault#81
feltech merged 1 commit into
mainfrom
fix/issue-78-gizmo-menu-refresh-segfault

Conversation

@feltech

@feltech feltech commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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.

@feltech feltech requested review from collindutter and Copilot June 17, 2026 11:29
@feltech feltech self-assigned this Jun 17, 2026
@feltech feltech force-pushed the fix/issue-78-gizmo-menu-refresh-segfault branch from c39d52b to 2c8a088 Compare June 17, 2026 11:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_nodes via a second nodes_toolbar.addMenu('Griptape') call after the removeItem loop 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.

Comment thread publish_gizmo/nuke_gizmo_publisher.py Outdated
@feltech feltech force-pushed the fix/issue-78-gizmo-menu-refresh-segfault branch 2 times, most recently from 39130f8 to 867037b Compare June 17, 2026 11:32
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.
@feltech feltech force-pushed the fix/issue-78-gizmo-menu-refresh-segfault branch from 867037b to 2e217d2 Compare June 17, 2026 11:33
@feltech feltech merged commit 152562b into main Jun 17, 2026
3 checks passed
@feltech feltech deleted the fix/issue-78-gizmo-menu-refresh-segfault branch June 17, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publishing a new gizmo version while Nuke is open crashes Nuke

3 participants