aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFAcroFormDocumentHelper.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-03-04 23:38:15 +0100
committerJay Berkenbilt <ejb@ql.org>2021-03-05 00:11:44 +0100
commitcb6e53136f05cb30a305f333023db24806fa53c7 (patch)
treeaee94951648e903869e157c2e2dce8ec281dab94 /libqpdf/QPDFAcroFormDocumentHelper.cc
parent0b77f2cf2646019331d3adc21985052319bdba4c (diff)
downloadqpdf-cb6e53136f05cb30a305f333023db24806fa53c7.tar.zst
QPDFAcroFormDocumentHelper: add missing analyze calls
Diffstat (limited to 'libqpdf/QPDFAcroFormDocumentHelper.cc')
-rw-r--r--libqpdf/QPDFAcroFormDocumentHelper.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/libqpdf/QPDFAcroFormDocumentHelper.cc b/libqpdf/QPDFAcroFormDocumentHelper.cc
index b0777f9b..0b3cc2ff 100644
--- a/libqpdf/QPDFAcroFormDocumentHelper.cc
+++ b/libqpdf/QPDFAcroFormDocumentHelper.cc
@@ -19,6 +19,10 @@ QPDFAcroFormDocumentHelper::QPDFAcroFormDocumentHelper(QPDF& qpdf) :
QPDFDocumentHelper(qpdf),
m(new Members())
{
+ // We have to analyze up front. Otherwise, when we are adding
+ // annotations and fields, we are in a temporarily unstable
+ // configuration where some widget annotations are not reachable.
+ analyze();
}
void
@@ -68,6 +72,7 @@ void
QPDFAcroFormDocumentHelper::addAndRenameFormFields(
std::vector<QPDFObjectHandle> fields)
{
+ analyze();
std::map<std::string, std::string> renames;
std::list<QPDFObjectHandle> queue;
queue.insert(queue.begin(), fields.begin(), fields.end());
@@ -214,8 +219,9 @@ QPDFAcroFormDocumentHelper::getFormFields()
std::set<QPDFObjGen>
QPDFAcroFormDocumentHelper::getFieldsWithQualifiedName(
- std::string const& name) const
+ std::string const& name)
{
+ analyze();
// Keep from creating an empty entry
std::set<QPDFObjGen> result;
auto iter = this->m->name_to_fields.find(name);
@@ -248,6 +254,7 @@ QPDFAcroFormDocumentHelper::getWidgetAnnotationsForPage(QPDFPageObjectHelper h)
std::vector<QPDFFormFieldObjectHelper>
QPDFAcroFormDocumentHelper::getFormFieldsForPage(QPDFPageObjectHelper ph)
{
+ analyze();
std::set<QPDFObjGen> added;
std::vector<QPDFFormFieldObjectHelper> result;
auto widget_annotations = getWidgetAnnotationsForPage(ph);