Commit 15269f36d8b7ca17f52b98d9e0f18c6eec102b7b

Authored by Jay Berkenbilt
1 parent 901f1a78

addFormField: update cache rather than invalidating

libqpdf/QPDFAcroFormDocumentHelper.cc
... ... @@ -35,7 +35,6 @@ QPDFAcroFormDocumentHelper::hasAcroForm()
35 35 void
36 36 QPDFAcroFormDocumentHelper::addFormField(QPDFFormFieldObjectHelper ff)
37 37 {
38   - invalidateCache();
39 38 auto acroform = this->qpdf.getRoot().getKey("/AcroForm");
40 39 if (! acroform.isDictionary())
41 40 {
... ... @@ -50,6 +49,9 @@ QPDFAcroFormDocumentHelper::addFormField(QPDFFormFieldObjectHelper ff)
50 49 acroform.replaceKey("/Fields", fields);
51 50 }
52 51 fields.appendItem(ff.getObjectHandle());
  52 + std::set<QPDFObjGen> visited;
  53 + traverseField(
  54 + ff.getObjectHandle(), QPDFObjectHandle::newNull(), 0, visited);
53 55 }
54 56  
55 57 std::vector<QPDFFormFieldObjectHelper>
... ...