Comment #3 on issue 1617 by
ni...@chromium.org: FPDFDOC_ExitFormFillEnvironment crashes
https://bugs.chromium.org/p/pdfium/issues/detail?id=1617#c3I wrote a little program like this, and no segfault was triggered. I understand that I might have some functions called which were not mentioned in the bug description. But hope this can help you solve the issue?
FPDF_DOCUMENT doc = FPDF_CreateNewDocument();
FPDF_PAGE page = FPDFPage_New(doc, 0, 640.0, 480.0);
FPDF_FORMFILLINFO formfillinfo;
formfillinfo.version = 1;
FPDF_FORMHANDLE form_handle = FPDFDOC_InitFormFillEnvironment(doc, &formfillinfo);
form_handle = SetupFormFillEnvironment(doc, JavaScriptOption::kEnableJavaScript);
FORM_OnAfterLoadPage(page, form_handle);
FORM_DoPageAAction(page, form_handle, FPDFPAGE_AACTION_OPEN);
FORM_DoPageAAction(page, form_handle, FPDFPAGE_AACTION_CLOSE);
FORM_OnBeforeClosePage (page, form_handle);
FORM_DoDocumentAAction(form_handle, FPDFDOC_AACTION_WC);
FPDFDOC_ExitFormFillEnvironment(form_handle);
form_handle = nullptr;
FPDF_CloseDocument(doc);
Let me know if you noticed anything is missing from this little program to reproduce the problem. Thanks!