Skip to content

Commit

Permalink
fix: Fix SharedArray JSI constructor allocating a new array instead…
Browse files Browse the repository at this point in the history
… of wrapping (#2444)
  • Loading branch information
mrousavy authored Jan 26, 2024
1 parent 7f4e037 commit c911d25
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jni::local_ref<JSharedArray::javaobject> JSharedArray::create(jsi::Runtime& runt
JSharedArray::JSharedArray(jsi::Runtime& runtime, std::shared_ptr<jsi::ArrayBuffer> arrayBuffer) {
size_t size = arrayBuffer->size(runtime);
__android_log_print(ANDROID_LOG_INFO, TAG, "Wrapping JSI ArrayBuffer with size %zu...", size);
jni::local_ref<JByteBuffer> byteBuffer = JByteBuffer::allocateDirect(size);
jni::local_ref<JByteBuffer> byteBuffer = JByteBuffer::wrapBytes(arrayBuffer->data(runtime), size);

_arrayBuffer = arrayBuffer;
_byteBuffer = jni::make_global(byteBuffer);
Expand Down

1 comment on commit c911d25

@vercel
Copy link

@vercel vercel bot commented on c911d25 Jan 26, 2024

Choose a reason for hiding this comment

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

Please # to comment.