Skip to content

Fix duplicate disposal of explicitly deleted OpenAL buffers - #3089

Open
adrian-andrzjewski wants to merge 1 commit into
jMonkeyEngine:masterfrom
adrian-andrzjewski:codex/issue-1864-audio-native-disposal
Open

adrian-andrzjewski wants to merge 1 commit into
jMonkeyEngine:masterfrom
adrian-andrzjewski:codex/issue-1864-audio-native-disposal

Conversation

@adrian-andrzjewski

Copy link
Copy Markdown

Explicit AudioBuffer deletion currently deletes its OpenAL buffer and resets the object but leaves the tracked clone in NativeObjectManager. On later cleanup, the manager can try to delete that native name again and hit the stale-object assertion.

Unregister the AudioBuffer from NativeObjectManager during deletion, and add a proxy-based regression test that verifies explicit deletion followed by manager cleanup calls alDeleteBuffers only once.

Closes #1864

Validation:

  • :jme3-core:test --tests com.jme3.audio.openal.ALAudioRendererDisposalTest
  • :jme3-core:test
  • :jme3-core:check
  • The regression failed before the fix and passed afterward.

@jaime-jmebot jaime-jmebot 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.

Hi Adrian, thanks for tackling this lifecycle bug and adding a focused regression test. The change addresses the core mismatch cleanly: after the renderer explicitly deletes an AudioBuffer's OpenAL name, it unregisters the corresponding manager entry before resetting the object, so later garbage-collection or shutdown cleanup cannot act on a stale clone.

I also checked the test path: it registers a buffer with the manager, exercises explicit deletion, and then runs manager cleanup while counting alDeleteBuffers calls. That directly captures the reported failure mode without requiring a live OpenAL context, and the proxy fails on unexpected API calls so the test stays narrowly scoped. I didn’t find any correctness concerns in the change. The PR reports the targeted test and broader core validation as passing; no CI checks are currently visible here. Looks good to me—thanks for the fix!

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.

Assertion failures in audio when deleting loaded objects, incorrect native disposal

2 participants