Hi
I’m getting an AV when closing my C++ application after having read barcodes with C++ lib 19.9 (installed via NuGet). The line that triggers exception later on is reader->Read().
Call stack;
aspose_cpp_vc141x64d.dll!00007ff9f08a68ee() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f08a6870() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f08a62cb() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f089ff11() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f0b3be74() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f0b3fedc() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f0b45f20() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f0b45ea0() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f0b4545b() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f0b3b2a1() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f27e6041() Unknown
> ucrtbased.dll!_execute_onexit_table::__l2::() Line 206 C++
ucrtbased.dll!__crt_seh_guarded_call::operator()<void (void),int (void) &,void (void)>(__acrt_lock_and_call::__l2::void (void) && setup, _execute_onexit_table::__l2::int (void) & action, __acrt_lock_and_call::__l2::void (void) && cleanup) Line 204 C++
ucrtbased.dll!__acrt_lock_and_call<int (void)>(const __acrt_lock_id lock_id, _execute_onexit_table::__l2::int (void) && action) Line 980 C++
ucrtbased.dll!_execute_onexit_table(_onexit_table_t * table) Line 231 C++
aspose_cpp_vc141x64d.dll!00007ff9f2626649() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f2628404() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f2628257() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f262854e() Unknown
aspose_cpp_vc141x64d.dll!00007ff9f2628641() Unknown
ntdll.dll!LdrpCallInitRoutine() Unknown
ntdll.dll!LdrShutdownProcess() Unknown
ntdll.dll!RtlExitUserProcess() Unknown
kernel32.dll!ExitProcessImplementation() Unknown
mscoreei.dll!RuntimeDesc::ShutdownAllActiveRuntimes(unsigned int,class RuntimeDesc *,enum RuntimeDesc::ShutdownCompatMode) Unknown
mscoreei.dll!CLRRuntimeHostInternalImpl::ShutdownAllRuntimesThenExit(unsigned int) Unknown
mscoreei.dll!_CorExeMain() Unknown
mscoree.dll!_CorExeMain_Exported() Unknown
kernel32.dll!BaseThreadInitThunk() Unknown
ntdll.dll!RtlUserThreadStart() Unknown
Code:
bool BarcodeHelper::barcodeExists(const unsigned char* filedata, const size_t filesize, const std::wstring& barcodetype, const std::wstring& barcodevalue)
{
setLicense();
System::SharedPtr<BaseDecodeType> decodetypes = DecodeType::AllSupportedTypes;
if (barcodetype.empty() == false && barcodetype != L"Any type")
{
const auto x = DecodeType::AllSupportedTypes->GetSingleTypes();
for (int idx = 0, count = x->get_Count(); idx < count; idx++)
{
const auto barcode = (*x)[idx];
if (barcode->get_TypeName().ToWCS() == barcodetype)
{
decodetypes = barcode;
break;
}
}
}
System::IO::MemoryStream::Ptr stream = System::MakeObject<System::IO::MemoryStream>();
// TODO: is this really the best way of getting data into Aspose?
for (size_t i = 0; i < filesize; i++)
stream->WriteByte(*(filedata + i));
stream->set_Position(0);
bool found = false;
System::SharedPtr<BarCodeReader> reader = System::MakeObject<BarCodeReader>(stream, decodetypes);
while (reader->Read())
{
// check if optional value matches
if (barcodevalue.empty() == true || reader->GetCodeText().ToWCS() == barcodevalue)
{
found = true;
break;
}
}
return found;
}
Can anyone spot any errors in my code or explain this?
Thanks,