Skip to content

Commit

Permalink
fix(android): resolve local ref overflow in convet_utils.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
1780243524 committed Jun 13, 2024
1 parent 0480ae9 commit 8f4bff3
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions android/sdk/src/main/jni/src/jni/convert_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,7 @@ std::tuple<bool, std::string, jobject> ConvertUtils::ToHippyMap(const std::share
j_env->DeleteLocalRef(key_j_obj);
j_env->DeleteLocalRef(value_j_obj);
}
auto tuple = std::make_tuple(true, "", obj);
j_env->DeleteLocalRef(obj);
return tuple;
return std::make_tuple(true, "", obj);
}

std::tuple<bool, std::string, jobject> ConvertUtils::ToHippyArray(const std::shared_ptr<Ctx>& ctx,
Expand All @@ -369,9 +367,7 @@ std::tuple<bool, std::string, jobject> ConvertUtils::ToHippyArray(const std::sha
JNIEnvironment::ClearJEnvException(j_env);
j_env->DeleteLocalRef(j_obj);
}
auto tuple = std::make_tuple(true, "", obj);
j_env->DeleteLocalRef(obj);
return tuple;
return std::make_tuple(true, "", obj);
}

std::tuple<bool, std::string, jobject> ConvertUtils::ToJObject(const std::shared_ptr<Ctx>& ctx,
Expand Down Expand Up @@ -410,11 +406,7 @@ std::tuple<bool, std::string, jobject> ConvertUtils::ToJObject(const std::shared
return std::make_tuple(false, "unsupported type in HippyArray or HippyMap",
static_cast<jobject>(nullptr));
}
auto tuple = std::make_tuple(true, "", result);
if (result) {
env->DeleteLocalRef(result);
}
return tuple;
return std::make_tuple(true, "", result);
}

std::unordered_map<std::string, MethodInfo> ConvertUtils::GetMethodMap(
Expand Down

0 comments on commit 8f4bff3

Please sign in to comment.