You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Indirect follow-on from #60. As pointed out by https://github.com/mara004, FPDF_GetLastError() only applies to nominated functions related to document loading, not to the Pdfium library generally. As a result, it is actually potentially harmful to use this function to check if other API calls returned an error, as it may return a false positive by re-raising an error previously already caught during document loading (since a call to FPDF_GetLastError() does not clear the error flag).
In light of this, rework all usage of FPDF_GetLastError() and PdfiumLibraryBindings::get_pdfium_last_error(). Consider removing get_pdfium_last_error() entirely.
The text was updated successfully, but these errors were encountered:
Thanks for the clear explanation on possible false positives.
Apart from that, calling FPDF_GetLastError() in other places is also just unnecessary and may have a slightly negative performance impact.
Removed PdfiumLibraryBindings::get_pdfium_last_error(). Reworked all usage of get_pdfium_last_error(). Restricted usage of FPDF_GetLastError() to Pdfium::pdfium_document_handle_to_result(). Confirmed all tests pass. Updated README.md.
Indirect follow-on from #60. As pointed out by https://github.com/mara004,
FPDF_GetLastError()
only applies to nominated functions related to document loading, not to the Pdfium library generally. As a result, it is actually potentially harmful to use this function to check if other API calls returned an error, as it may return a false positive by re-raising an error previously already caught during document loading (since a call toFPDF_GetLastError()
does not clear the error flag).A recent update to the inline documentation clarifies that
FPDF_GetLastError()
should only be checked after specific functions: https://pdfium.googlesource.com/pdfium/+/e116d6ebc253640da997d10b533dd9aed6aa1c23In light of this, rework all usage of
FPDF_GetLastError()
andPdfiumLibraryBindings::get_pdfium_last_error()
. Consider removingget_pdfium_last_error()
entirely.The text was updated successfully, but these errors were encountered: