[poppler] poppler/Catalog.cc poppler/Form.cc poppler/Form.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 17 15:35:41 UTC 2022


 poppler/Catalog.cc |    2 +-
 poppler/Form.cc    |    8 ++++----
 poppler/Form.h     |    6 +-----
 3 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 9c1c8dcdae6eef00651d2189ff2288752eac52c0
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Mar 17 15:55:30 2022 +0100

    Form: Don't store stuff we don't use

diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index e8ae8552..7c2eff84 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -1064,7 +1064,7 @@ Form *Catalog::getForm()
     catalogLocker();
     if (!form) {
         if (acroForm.isDict()) {
-            form = new Form(doc, &acroForm);
+            form = new Form(doc);
             // perform form-related loading after all widgets have been loaded
             form->postWidgetsLoad();
         }
diff --git a/poppler/Form.cc b/poppler/Form.cc
index 65844726..44e4e394 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -2489,13 +2489,11 @@ void FormFieldSignature::print(int indent)
 // Form
 //------------------------------------------------------------------------
 
-Form::Form(PDFDoc *docA, Object *acroFormA)
+Form::Form(PDFDoc *doc)
 {
     Object obj1;
 
-    doc = docA;
-    xref = doc->getXRef();
-    acroForm = acroFormA;
+    XRef *xref = doc->getXRef();
 
     size = 0;
     numFields = 0;
@@ -2504,6 +2502,8 @@ Form::Form(PDFDoc *docA, Object *acroFormA)
     defaultAppearance = nullptr;
     defaultResources = nullptr;
 
+    Object *acroForm = doc->getCatalog()->getAcroForm();
+
     needAppearances = acroForm->dictLookup("NeedAppearances").getBoolWithDefaultValue(false);
 
     obj1 = acroForm->dictLookup("DA");
diff --git a/poppler/Form.h b/poppler/Form.h
index 76ca9648..9cc35e03 100644
--- a/poppler/Form.h
+++ b/poppler/Form.h
@@ -668,7 +668,7 @@ private:
 class POPPLER_PRIVATE_EXPORT Form
 {
 public:
-    Form(PDFDoc *docA, Object *acroForm);
+    explicit Form(PDFDoc *doc);
 
     ~Form();
 
@@ -683,7 +683,6 @@ public:
        Page::loadStandaloneFields */
     static FormField *createFieldFromDict(Object &&obj, PDFDoc *docA, const Ref aref, FormField *parent, std::set<int> *usedParents);
 
-    Object *getObj() const { return acroForm; }
     bool getNeedAppearances() const { return needAppearances; }
     int getNumFields() const { return numFields; }
     FormField *getRootField(int i) const { return rootFields[i]; }
@@ -706,9 +705,6 @@ private:
     FormField **rootFields;
     int numFields;
     int size;
-    PDFDoc *doc;
-    XRef *xref;
-    Object *acroForm;
     bool needAppearances;
     GfxResources *defaultResources;
     Object resDict;


More information about the poppler mailing list