Skip to content

fix: bind native handles to the class that declares them - #438

Open
devopvoid wants to merge 1 commit into
mainfrom
fix/bind-native-handles
Open

devopvoid wants to merge 1 commit into
mainfrom
fix/bind-native-handles

Conversation

@devopvoid

Copy link
Copy Markdown
Owner

Native code looked up handle fields on an object's dynamic class, so a subclass declaring a field of the same name (e.g. long nativeHandle in an AudioResampler subclass) received the pointer, and its field initializer could overwrite it.

  • GetHandleField and the helpers built on it now require the declaring class, check that the object is an instance of it, and cache the field ID.
  • NativeHandle.h binds the default nativeHandle to NativeObject; named handles (observerHandle, processorHostHandle, callbackHandle, the factory's thread handles) name their class.
  • CustomVideoSource.pushFrame rejects buffers that are no NativeI420Buffer instead of reading a field of a Java buffer as a pointer.

Handles were looked up on the object's dynamic class, so a subclass field of the same name received the pointer. The lookup now always names the declaring class, checks the instance and caches the field.

This branch has not been deployed

No deployments
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