Skip to content

fix(jni): release handles and arrays on allocation failures - #1100

Merged
andiwand merged 2 commits into
mainfrom
review/82-jni-allocation-cleanup
Oct 5, 2026
Merged

andiwand merged 2 commits into
mainfrom
review/82-jni-allocation-cleanup

Conversation

@andiwand

@andiwand andiwand commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

JNI handle construction now keeps ownership until its tracking vector accepts the handle, preventing a leak when that allocation fails. Decode priorities and selected HTML views use array-region copies instead of pins that could survive C++ exceptions. Array lengths are checked before narrowing to JNI sizes, and logger setup stops after failed reference/method allocation.

Validation: all 81 JNI tests pass. Extended existing decode-option and selected-view export tests; no additional test cases. A temporary allocation-failure harness reproduces the handle leak on the parent revision and passes after the fix.

@andiwand
andiwand force-pushed the review/81-jni-integer-bounds branch from 308873c to afc3a6e Compare October 5, 2026 20:32
Base automatically changed from review/81-jni-integer-bounds to main October 5, 2026 20:33
@andiwand
andiwand force-pushed the review/82-jni-allocation-cleanup branch from 19e69f9 to 413414f Compare October 5, 2026 20:34
@andiwand
andiwand merged commit 89b0b8a into main Oct 5, 2026
23 checks passed
@andiwand
andiwand deleted the review/82-jni-allocation-cleanup branch October 5, 2026 20:43
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.

1 participant