HarmonyOS鸿蒙Next中pdfPage调用removeAnnotation时cppcrash报错SIGSEGV(SEGV_MAPERR)@000000000000000000 probably caused by NULL point

HarmonyOS鸿蒙Next中pdfPage调用removeAnnotation时cppcrash报错SIGSEGV(SEGV_MAPERR)@000000000000000000 probably caused by NULL point

这是代码:

这是报错:

Process life time:18446744073709478325s
Reason:Signal:SIGSEGV(SEGV_MAPERR)[@000000000000000000](/user/000000000000000000)  probably caused by NULL pointer dereference
Fault thread info:
Tid:30900, Name:example.testndk
#00 pc 00000000001b4a8c /system/lib/ld-musl-aarch64.so.1(wcslen+4)(fcd7546c77afd9beb3928bf57e700a17)
#01 pc 0000000000041c64 /system/lib64/module/hms/officeservice/libpdfservice.z.so(std::__h::basic_string<wchar_t, std::__h::char_traits<wchar_t>, std::__h::allocator<wchar_t>>::basic_string[abi:v15004]<std::nullptr_t>(wchar_t const*)+48)(4614e8930b809965fde1a5e200811253)
#02 pc 000000000005e784 /system/lib64/module/hms/officeservice/libpdfservice.z.so(PDFService::PDFPage::RemoveAnnotation(napi_env__*, napi_callback_info__*)+280)(4614e8930b809965fde1a5e200811253)
#03 pc 000000000003d724 /system/lib64/platformsdk/libace_napi.z.so(panda::JSValueRef ArkNativeFunctionCallBack<true>(panda::JsiRuntimeCallInfo*)+216)(3ed90810756979f8616e8769b1dfc611)
#04 pc 0000000000405b2c /system/lib64/module/arkcompiler/stub.an(RTStub_PushCallArgsAndDispatchNative+40)

更多关于HarmonyOS鸿蒙Next中pdfPage调用removeAnnotation时cppcrash报错SIGSEGV(SEGV_MAPERR)@000000000000000000 probably caused by NULL point的实战教程也可以访问 https://www.itying.com/category-93-b0.html

4 回复

看您上面截图代码示例


const pdfDocument: pdfService.PdfDocument = new pdfService.PdfDocument();

下下行


const page: pdfService.PdfPage = pdfDocument.getPage(0);

page返回结果为undefined。

再下一行就crash了,走不到removeAnnotation这里,是否方便提供可复现demo?

更多关于HarmonyOS鸿蒙Next中pdfPage调用removeAnnotation时cppcrash报错SIGSEGV(SEGV_MAPERR)@000000000000000000 probably caused by NULL point的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


是在removeAnnotation这儿crash的 之前的日志都是打印了的,

您好,为了更快速解决您的问题,并且吸引更多用户一同参与您问题的解答与讨论,建议您补全如下信息:

补全版本信息,让参与用户更快速复现您的问题;

更多提问技巧,请参考:【Tips】如何提个好问题

在HarmonyOS鸿蒙Next中,pdfPage.removeAnnotation调用时出现SIGSEGV错误,通常是由于传入的annotation对象为NULL或未正确初始化。建议检查以下几点:

  1. 确保annotation对象已正确创建并初始化。
  2. 在调用removeAnnotation之前,验证annotation对象是否为NULL
  3. 检查pdfPage对象是否有效,避免在无效的pdfPage上操作。

通过以上步骤,可以有效避免NULL指针导致的崩溃问题。

回到顶部