HarmonyOS context getApplicationContext偶现崩溃

在AbilityStage获取context。

BasicConfig.getInstance().setAppContext(this.context.getApplicationContext())
const context = BasicConfig.getInstance().getAppContext()
if (context) {
  AuthCenter.initUdb(context.getApplicationContext(), new LoginAuthHandler())
}

崩溃日志:

#00 pc 0000000000474d94 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::NonMovableMarker::HandleRangeRoots(unsigned int, panda::ecmascript::Root, panda::ecmascript::ObjectSlot, panda::ecmascript::ObjectSlot)+260)(95b2781bd3970de0ded17d64930b4bc8)
#01 pc 0000000000309770 /system/lib64/platformsdk/libark_jsruntime.so(95b2781bd3970de0ded17d64930b4bc8)
#02 pc 0000000000315bac /system/lib64/platformsdk/libark_jsruntime.so(95b2781bd3970de0ded17d64930b4bc8)
#03 pc 000000000041dc18 /system/lib64/platformsdk/libark_jsruntime.so(95b2781bd3970de0ded17d64930b4bc8)
#04 pc 00000000004649e8 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::Marker::MarkRoots(unsigned int)+276)(95b2781bd3970de0ded17d64930b4bc8)
#05 pc 0000000000435f24 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::ConcurrentMarker::InitializeMarking()+244)(95b2781bd3970de0ded17d64930b4bc8)
#06 pc 0000000000435c74 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::ConcurrentMarker::Mark()+408)(95b2781bd3970de0ded17d64930b4bc8)
#07 pc 000000000044603c /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::Heap::TriggerConcurrentMarking()+108)(95b2781bd3970de0ded17d64930b4bc8)
#08 pc 0000000000449bdc /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::Heap::TryTriggerConcurrentMarking()+676)(95b2781bd3970de0ded17d64930b4bc8)
#09 pc 000000000044fb10 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::LinearSpace::Allocate(unsigned long, bool)+164)(95b2781bd3970de0ded17d64930b4bc8)
#10 pc 00000000004f6600 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::ObjectFactory::NewJSObject(panda::ecmascript::JSHandle<panda::ecmascript::JSHClass> const&)+132)(95b2781bd3970de0ded17d64930b4bc8)
#11 pc 00000000004f9e3c /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::ObjectFactory::NewJSFunctionByHClass(panda::ecmascript::JSHandle<panda::ecmascript::Method> const&, panda::ecmascript::JSHandle<panda::ecmascript::JSHClass> const&, panda::ecmascript::MemSpaceType)+76)(95b2781bd3970de0ded17d64930b4bc8)
#12 pc 0000000000500bb4 /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::ObjectFactory::NewJSFunction(panda::ecmascript::JSHandle<panda::ecmascript::GlobalEnv> const&, void const*, panda::ecmascript::FunctionKind, panda::ecmascript::kungfu::BuiltinsStubCSigns::ID, panda::ecmascript::MemSpaceType)+280)(95b2781bd3970de0ded17d64930b4bc8)
#13 pc 00000000004d8224 /system/lib64/platformsdk/libark_jsruntime.so(panda::FunctionRef::NewConcurrent(panda::ecmascript::EcmaVM*, panda::JSValueRef (*)(panda::JsiRuntimeCallInfo*), void (*)(void*, void*, void*), void*, bool, unsigned long)+172)(95b2781bd3970de0ded17d64930b4bc8)
#14 pc 000000000004c098 /system/lib64/platformsdk/libace_napi.z.so(napi_create_function+244)(b6e1f7201887fd380757eb122af83fe1)
#15 pc 00000000000710f0 /system/lib64/platformsdk/libruntime.z.so(OHOS::AbilityRuntime::BindNativeFunction(napi_env__*, napi_value__*, char const*, char const*, napi_value__* (*)(napi_env__*, napi_callback_info__*))+256)(56cc65f02638320d7fbdc380bac8683f)
#16 pc 0000000000018ea8 /system/lib64/platformsdk/libapp_context_utils.z.so(OHOS::AbilityRuntime::JsApplicationContextUtils::BindNativeApplicationContext(napi_env__*, napi_value__*)+784)(ce3fd3bc0e3ce3e5264485bbfe7d40ed)
#17 pc 0000000000018a0c /system/lib64/platformsdk/libapp_context_utils.z.so(OHOS::AbilityRuntime::JsApplicationContextUtils::CreateJsApplicationContext(napi_env__*)+600)(ce3fd3bc0e3ce3e5264485bbfe7d40ed)
#18 pc 00000000000184a4 /system/lib64/platformsdk/libapp_context_utils.z.so(OHOS::AbilityRuntime::JsApplicationContextUtils::OnGetApplicationContext(napi_env__*, OHOS::AbilityRuntime::NapiCallbackInfo&)+172)(ce3fd3bc0e3ce3e5264485bbfe7d40ed)
#19 pc 00000000000183c8 /system/lib64/platformsdk/libapp_context_utils.z.so(OHOS::AbilityRuntime::JsApplicationContextUtils::GetApplicationContext(napi_env__*, napi_callback_info__*)+96)(ce3fd3bc0e3ce3e5264485bbfe7d40ed)
#20 pc 00000000000359ac /system/lib64/platformsdk/libace_napi.z.so(panda::JSValueRef ArkNativeFunctionCallBack<true>(panda::JsiRuntimeCallInfo*)+220)(b6e1f7201887fd380757eb122af83fe1)
#21 pc 0000000000302054 /system/lib64/module/arkcompiler/stub.an(RTStub_PushCallArgsAndDispatchNative+40)
#22 at getApplicationContext (/usr1/hmos_for_system/src/increment/sourcecode/foundation/ability/ability_runtime/frameworks/js/napi/app/application_context/application_context.js:137:1)
#23 at anonymous (products/phone/src/main/ets/init/task/InitUDBTask.ets:24:26
HarmonyOS
2天前
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
fox280

具体分析可以参考文档,CppCrash故障定位指导:https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-cppcrash-guidance-V5

分享
微博
QQ
微信
回复
1天前
相关问题
HarmonyOS 接口返回空字段
113浏览 • 1回复 待解决
HarmonyOS media.AVPlayer报错
100浏览 • 1回复 待解决
HarmonyOS app图标显示错误
226浏览 • 1回复 待解决
HarmonyOS 视频播放 5400106 错误码
221浏览 • 1回复 待解决
HarmonyOS ArkTS调C++ 方法找不到。
680浏览 • 1回复 待解决
router.back调用时,app自动退出
1825浏览 • 1回复 待解决
HarmonyOS getApplicationContext() 注释问题
121浏览 • 1回复 待解决