Commit c674566f authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

Fix memory leaks in OptionalContent

parent 06ca313b
......@@ -28,7 +28,7 @@
//------------------------------------------------------------------------
OCGs::OCGs(Object *ocgObject, XRef *xref) :
m_orderArray(0), m_rBGroupsArray(), m_xref(xref)
m_xref(xref)
{
// we need to parse the dictionary here, and build optionalContentGroups
ok = gTrue;
......@@ -126,17 +126,8 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) :
}
off.free();
Object order;
defaultOcgConfig.dictLookup("Order", &order);
if ( (order.isArray()) && (order.arrayGetLength() > 0) ) {
m_orderArray = order.getArray();
}
Object rbgroups;
defaultOcgConfig.dictLookup("RBGroups", &rbgroups);
if ( (rbgroups.isArray()) && (rbgroups.arrayGetLength() > 0) ) {
m_rBGroupsArray = rbgroups.getArray();
}
ocgList.free();
defaultOcgConfig.free();
......@@ -145,6 +136,8 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) :
OCGs::~OCGs()
{
deleteGooList(optionalContentGroups, OptionalContentGroup);
order.free();
rbgroups.free();
}
......
......@@ -40,8 +40,10 @@ public:
OptionalContentGroup* findOcgByRef( const Ref &ref);
Array* getOrderArray() const { return m_orderArray; }
Array* getRBGroupsArray() const { return m_rBGroupsArray; }
Array* getOrderArray()
{ return (order.isArray() && order.arrayGetLength() > 0) ? order.getArray() : NULL; }
Array* getRBGroupsArray()
{ return (rbgroups.isArray() && rbgroups.arrayGetLength()) ? rbgroups.getArray() : NULL; }
bool optContentIsVisible( Object *dictRef );
......@@ -55,8 +57,8 @@ private:
GooList *optionalContentGroups;
Array *m_orderArray;
Array *m_rBGroupsArray;
Object order;
Object rbgroups;
XRef *m_xref;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment