OptionalContent: Save unneeded copy() calls
diff --git a/poppler/OptionalContent.cc b/poppler/OptionalContent.cc
index 7a5db5c..f4906bf 100644
--- a/poppler/OptionalContent.cc
+++ b/poppler/OptionalContent.cc
@@ -46,19 +46,19 @@
 
   // we now enumerate over the ocgList, and build up the optionalContentGroups list.
   for(int i = 0; i < ocgList.arrayGetLength(); ++i) {
-    Object ocg = ocgList.arrayGet(i);
-    if (!ocg.isDict()) {
+    Object ocgDict = ocgList.arrayGet(i);
+    if (!ocgDict.isDict()) {
       break;
     }
-    auto thisOptionalContentGroup = std::make_unique<OptionalContentGroup>(ocg.getDict());
-    ocg = ocgList.arrayGetNF(i).copy();
-    if (!ocg.isRef()) {
+    auto thisOptionalContentGroup = std::make_unique<OptionalContentGroup>(ocgDict.getDict());
+    const Object &ocgRef = ocgList.arrayGetNF(i);
+    if (!ocgRef.isRef()) {
       break;
     }
-    thisOptionalContentGroup->setRef( ocg.getRef() );
+    thisOptionalContentGroup->setRef( ocgRef.getRef() );
     // the default is ON - we change state later, depending on BaseState, ON and OFF
     thisOptionalContentGroup->setState(OptionalContentGroup::On);
-    optionalContentGroups.emplace(ocg.getRef(), std::move(thisOptionalContentGroup));
+    optionalContentGroups.emplace(ocgRef.getRef(), std::move(thisOptionalContentGroup));
   }
 
   Object defaultOcgConfig = ocgObject->dictLookup("D");
@@ -367,7 +367,7 @@
 
 //------------------------------------------------------------------------
 
-OCDisplayNode *OCDisplayNode::parse(Object *obj, OCGs *oc,
+OCDisplayNode *OCDisplayNode::parse(const Object *obj, OCGs *oc,
 				    XRef *xref, int recursion) {
   OptionalContentGroup *ocgA;
   OCDisplayNode *node, *child;
@@ -399,7 +399,7 @@
     node = new OCDisplayNode();
   }
   for (; i < obj2.arrayGetLength(); ++i) {
-    Object obj3 = obj2.arrayGetNF(i).copy();
+    const Object &obj3 = obj2.arrayGetNF(i);
     if ((child = OCDisplayNode::parse(&obj3, oc, xref, recursion + 1))) {
       if (!child->ocg && !child->name && node->getNumChildren() > 0) {
 	node->getChild(node->getNumChildren() - 1)->addChildren(child->takeChildren());
diff --git a/poppler/OptionalContent.h b/poppler/OptionalContent.h
index f9c5260..e4144e6 100644
--- a/poppler/OptionalContent.h
+++ b/poppler/OptionalContent.h
@@ -118,7 +118,7 @@
 class OCDisplayNode {
 public:
 
-  static OCDisplayNode *parse(Object *obj, OCGs *oc, XRef *xref, int recursion = 0);
+  static OCDisplayNode *parse(const Object *obj, OCGs *oc, XRef *xref, int recursion = 0);
   OCDisplayNode();
   ~OCDisplayNode();