fix: Fix SharedArray
JSI constructor allocating a new array instead of wrapping (#2444)
This commit is contained in:
parent
7f4e037f25
commit
c911d25727
@ -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) {
|
JSharedArray::JSharedArray(jsi::Runtime& runtime, std::shared_ptr<jsi::ArrayBuffer> arrayBuffer) {
|
||||||
size_t size = arrayBuffer->size(runtime);
|
size_t size = arrayBuffer->size(runtime);
|
||||||
__android_log_print(ANDROID_LOG_INFO, TAG, "Wrapping JSI ArrayBuffer with size %zu...", size);
|
__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;
|
_arrayBuffer = arrayBuffer;
|
||||||
_byteBuffer = jni::make_global(byteBuffer);
|
_byteBuffer = jni::make_global(byteBuffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user