Skip to content

Commit

Permalink
🐞 fix: Fix improper memory span in Node.js mode
Browse files Browse the repository at this point in the history
  • Loading branch information
caoccao committed Apr 9, 2024
1 parent 69a6372 commit 8317c80
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cpp/jni/javet_jni_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ JNIEXPORT jobject JNICALL Java_com_caoccao_javet_interop_V8Native_moduleCreate
}
}
}
#ifndef ENABLE_NODE
v8::MemorySpan<const V8LocalString> exportNamesMemorySpan(exportNames.begin(), exportNames.end());
#endif
auto v8LocalModule = v8::Module::CreateSyntheticModule(
v8Context->GetIsolate(),
Javet::Converter::ToV8String(jniEnv, v8Context, mModuleName),
#ifdef ENABLE_NODE
exportNames,
#else
exportNamesMemorySpan,
#endif
Javet::Callback::JavetSyntheticModuleEvaluationStepsCallback);
std::string stringKey("module:{}" + std::to_string(v8LocalModule->GetIdentityHash()));
auto v8LocalStringKey = Javet::Converter::ToV8String(v8Context, stringKey.c_str());
Expand Down

0 comments on commit 8317c80

Please sign in to comment.