Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Fix weex call native error #2013

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,17 @@ static std::unique_ptr<IPCResult> HandleCallGCanvasLinkNative(
// retVal = WeexCoreManager::Instance()->script_bridge()->core_side()->CallGCanvasLinkNative(pageId, type,
// args);

std::unique_ptr<IPCResult> ret = createVoidResult();
if (retVal) {
jstring jDataStr = env->NewStringUTF(retVal);
ret = std::unique_ptr<IPCResult>(
new IPCStringResult(jstring2WeexString(env, jDataStr)));
env->DeleteLocalRef(jDataStr);
retVal = NULL;
std::unique_ptr<IPCResult> ret = createVoidResult();
if (retVal) {
jstring jDataStr = env->NewStringUTF(retVal);
ret = std::unique_ptr<IPCResult>(
new IPCStringResult(jstring2WeexString(env, jDataStr)));
env->DeleteLocalRef(jDataStr);
if (strlen(retVal) > 0) {
delete retVal;
}
retVal = NULL;
}
// env->DeleteLocalRef(jPageId);
// env->DeleteLocalRef(val);
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,14 @@ JSFUNCTION functionGCanvasLinkNative(ExecState *state) {
JSValue arg_js = state->argument(2);
String arg_str = arg_js.toWTFString(state);

auto result = globalObject->js_bridge()->core_side()->CallGCanvasLinkNative(id_str.utf8().data(),
const char * resultChar = globalObject->js_bridge()->core_side()->CallGCanvasLinkNative(id_str.utf8().data(),
type, arg_str.utf8().data());
return JSValue::encode(String2JSValue(state, result));
auto result = resultChar;
auto ret = JSValue::encode(String2JSValue(state, result));
if (strlen(resultChar) > 0) {
delete resultChar;
}
return ret;
}

JSFUNCTION functionT3DLinkNative(ExecState *state) {
Expand Down