Page 1 of 1

memory problem with Stamp annotation

Posted: Mon Apr 26, 2021 1:49 pm
by aleksand
Hi,

I use c++ coreApi sdk. I implement add Stamp annotation to pdf and after start closing my application problem with memory begin (crash and create hs-* error file) .
I use like code for create new stamp annotation (it is not full but this part is enough for reproduce problem):
PXC::ULONG_T nAtom;
hr = g_COS->StrToAtom(L"Stamp", &nAtom);
PXC::PXC_Rect rcAnnotRect;
setRecAnnot(rcAnnotRect, x, y, w, h, W, H, rot);
CComPtr<PXC::IPXC_Annotation> annot;
hr = pPage->InsertNewAnnot(nAtom, &rcAnnotRect, -1, &annot);

If this part is used my application generate file hs_err_pid*.log. I investigated problem and found that this code is used FinalizeSDK() (from your examples) throw exeption. If name of annotation is changed to "FreeText" for example (hr = g_COS->StrToAtom(L"FreeText", &nAtom); ) FinalizeSDK() do not throw exeption.

p.s. hs_err_pid*.log has not any good info about problem.


Thanks,
Evgeny.

Re: memory problem with Stamp annotation

Posted: Mon Apr 26, 2021 1:56 pm
by Sasha - Tracker Dev Team
Hello aleksand,

Can you please prepare a small console project to illustrate this behavior?
You can use this project for quick start:
https://github.com/tracker-software/PDF ... eAPISample

Cheers,
Alex

Re: memory problem with Stamp annotation

Posted: Fri Apr 30, 2021 8:25 am
by aleksand
Hi Alex,

Sorry for long answer. I tried to reproduce on your examples (console and mfs), but can not. I investigate more and I hope that I found the problem. I use CoreApi from java like dynamic dlls. The problem is exist only if I do not call finalizaSDK before DllProcessDetach (or call finalizaSDK from DllProcessDetach). It was just a surprise for me that this problem only exists if an attempt is made to add a stamp annotation (other annotations no crash even in case call finalizaSDK in DllProcessDetach).

p.s. I am not sure that it is the bug, because description from Microsoft wrote that use free library in DllProcessDetach is dangerous.

Cheers,
Evgeny.

memory problem with Stamp annotation

Posted: Tue May 04, 2021 8:48 am
by Sasha - Tracker Dev Team
:)