Hello,

a branch[1] has been created to add automatic ownership handling
to PdfObject. The issue with current handling of PdfObject ownership
is that it's inconsistent and hacky: objects retrieved directly
from PdfDictionary or PdfArray won't have owner set, even if one
PdfObject is actually storing these containers. The hack currently
performed is to set the owner when retrieving objects trough
PdfObject::GetIndirectKey(), but this work only for dictionaries
(not arrays) and looks fragile as the objects inside dictionaries
have inconsistent state despite being part of the document hierarchy.

The patch introduce a mechanism to maintain the ownership of PdfObject
automatically by:
- Adding PdfObject ownership to both PdfDictionary and PdfArray by
inheriting a common PdfOwnedDataType;
- Adding a proper semantics for setting owner of PdfObjects: copying
objects won't copy owner (it will stay NULL) and assigning objects will
keep current owner;
- Inserting an object into a PdfDctionary or a PdfArray will set the
ownership in the copied object recursively.

Some convenience method are also added to PdfArray and PdfDictionaries:
- PdfDictionary::FindKey(key) : find objects following references,
same as previous PdfObject::GetIndirectKey();
- PdfDictionary::FindKeyParent(key): find objects following references
and "/Parent" references. Useful for PdfField and super classes;
- PdfArray::FindAt(idx) : find objects following references.

The patch introduces some ABI changes to add some common base class
functionalities to PdfDictionary, PdfArray. It's also potentially API
breaking since PdfObject::SetOwner() is now private. Of course it's
possible to leave it public but I don't recommend it since owner handling
should be totally hidden to API user and the compilation fix
is just to remove the call.

The branch applies consists of 3 commits:
   1) PdfArray: Removed inheritance from std::vector
   2) PdfObject: Introduced automatic ownership handling
   3) PdfFontFactory: Fix lookup Type 0 fonts with inline DescendantFonts
     array

1) Clean PdfArray from fishy inheritance from std::vector and follows
approach of PdfDictionary to just wrap it preserving API compatibility.
2) is the core change while 3) is the first PoDoFo bug fixed taking
advantage of the change that allows to fix it without hacks.

I have been tested this change for several months now. I also ran
the changeset against unit tests and it succeeded.

Next steps could be:
- Extensively use PdfDictionary::FindKeyParent(key) in PdfField and super
classes to support fields hierarchies;
- Evaluate deprecation of PdfObject::GetIndirectKey() as same
functionality is now provided directly inside PdfDictionary in
a more consistent API.

Attached is the class diagram of the proposed PdfOwnedDatatype and the
whole change as a single patch against trunk r1990.

[1] https://svn.code.sf.net/p/podofo/code/podofo/branches/ObjectAutoOwnership
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 256beef..08b5124 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -290,7 +290,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
 
     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
 
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Woverloaded-virtual -Wswitch-enum -Wcast-qual -Wwrite-strings -Wredundant-decls -Wreorder -Wno-deprecated-declarations")
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Woverloaded-virtual -Wswitch -Wcast-qual -Wwrite-strings -Wredundant-decls -Wreorder -Wno-deprecated-declarations")
 
     #
     # Note that we do not need debug definitions here. Set
diff --git a/src/podofo/CMakeLists.txt b/src/podofo/CMakeLists.txt
index 72bbd97..bba6b5f 100644
--- a/src/podofo/CMakeLists.txt
+++ b/src/podofo/CMakeLists.txt
@@ -16,6 +16,7 @@ SET(PODOFO_BASE_SOURCES
   base/PdfContentsTokenizer.cpp
   base/PdfData.cpp
   base/PdfDataType.cpp
+  base/PdfOwnedDataType.cpp
   base/PdfDate.cpp
   base/PdfDictionary.cpp
   base/PdfEncoding.cpp
@@ -124,6 +125,7 @@ SET(PODOFO_BASE_HEADERS
    base/PdfContentsTokenizer.h
    base/PdfData.h
    base/PdfDataType.h
+   base/PdfOwnedDataType.h
    base/PdfDate.h
    base/PdfDefines.h
    base/PdfDefinesPrivate.h
diff --git a/src/podofo/base/PdfArray.cpp b/src/podofo/base/PdfArray.cpp
index b65dcf8..07c6620 100644
--- a/src/podofo/base/PdfArray.cpp
+++ b/src/podofo/base/PdfArray.cpp
@@ -41,7 +41,18 @@
 namespace PoDoFo {
 
 PdfArray::PdfArray()
-    : PdfArrayBaseClass(), PdfDataType(), m_bDirty( false )
+    : m_bDirty( false )
+{
+}
+
+PdfArray::PdfArray( const PdfObject &var )
+    : m_bDirty( false )
+{
+    this->push_back( var );
+}
+
+PdfArray::PdfArray(const PdfArray & rhs)
+    : PdfOwnedDataType( rhs ), m_bDirty( rhs.m_bDirty ), m_objects( rhs.m_objects )
 {
 }
 
@@ -49,25 +60,60 @@ PdfArray::~PdfArray()
 {
 }
 
-PdfArray::PdfArray( const PdfObject & var )
-    : PdfArrayBaseClass(), PdfDataType(), m_bDirty( false )
+PdfObject * PdfArray::findAt( size_type idx ) const
 {
-    this->push_back( var );
+    PdfObject *obj = &const_cast<PdfArray *>( this )->m_objects[idx];
+    if ( obj->IsReference() )
+        return GetIndirectObject( obj->GetReference() );
+    else
+        return obj;
 }
 
-PdfArray::PdfArray( const PdfArray & rhs )
-    : PdfArrayBaseClass(rhs), PdfDataType(rhs), m_bDirty(rhs.m_bDirty)
+void PdfArray::clear()
 {
-    this->operator=( rhs );
+    AssertMutable();
+    if ( m_objects.size() == 0 )
+        return;
+
+    m_objects.clear();
+    m_bDirty = true;
+}
+
+PdfArray::iterator PdfArray::insert( const iterator &pos, const PdfObject &val )
+{
+    AssertMutable();
+
+    m_bDirty = true;
+    iterator ret = m_objects.insert( pos, val );
+    PdfVecObjects *pOwner = GetObjectOwner();
+    if ( pOwner != NULL )
+        ret->SetOwner( pOwner );
+    return ret;
 }
 
+void PdfArray::erase( const iterator &pos )
+{
+    AssertMutable();
+
+    m_objects.erase( pos );
+    m_bDirty = true;
+}
+
+void PdfArray::erase( const iterator &first, const iterator &last )
+{
+    AssertMutable();
+
+    m_objects.erase( first, last );
+    m_bDirty = true;
+}
  
-PdfArray& PdfArray::operator=(const PdfArray& rhs)
+PdfArray& PdfArray::operator=( const PdfArray &rhs )
 {
     if (this != &rhs)
     {
         m_bDirty = rhs.m_bDirty;
-        PdfArrayBaseClass::operator=( rhs );
+        m_objects = rhs.m_objects;
+        this->PdfOwnedDataType::operator=( rhs );
     }
     else
     {
@@ -77,6 +123,22 @@ PdfArray& PdfArray::operator=(const PdfArray& rhs)
     return *this;
 }
 
+void PdfArray::resize( size_t count, value_type val )
+{
+    AssertMutable();
+
+    size_t currentSize = size();
+    m_objects.resize( count, val );
+    PdfVecObjects *pOwner = GetObjectOwner();
+    if ( pOwner != NULL )
+    {
+        for ( size_t i = currentSize; i < count; i++ )
+            m_objects[i].SetOwner( pOwner );
+    }
+
+    m_bDirty = currentSize != count;
+}
+
 void PdfArray::Write( PdfOutputDevice* pDevice, EPdfWriteMode eWriteMode, 
                       const PdfEncrypt* pEncrypt ) const
 {
@@ -183,4 +245,18 @@ void PdfArray::SetDirty( bool bDirty )
     }
 }
 
+void PdfArray::SetOwner( PdfObject *pOwner )
+{
+    PdfOwnedDataType::SetOwner( pOwner );
+    PdfVecObjects *pVecOwner = pOwner->GetOwner();
+    if ( pVecOwner != NULL )
+    {
+        // Set owmership for all children
+        PdfArray::iterator it = this->begin();
+        PdfArray::iterator end = this->end();
+        for ( ; it != end; it++ )
+            it->SetOwner( pVecOwner );
+    }
+}
+
 };
diff --git a/src/podofo/base/PdfArray.h b/src/podofo/base/PdfArray.h
index 88254e6..6e15256 100644
--- a/src/podofo/base/PdfArray.h
+++ b/src/podofo/base/PdfArray.h
@@ -42,13 +42,11 @@
 #endif // _WIN32
 
 #include "PdfDefines.h"
-#include "PdfDataType.h"
+#include "PdfOwnedDataType.h"
 #include "PdfObject.h"
 
 namespace PoDoFo {
 
-typedef std::vector<PdfObject> PdfArrayBaseClass;
-
 /** This class represents a PdfArray
  *  Use it for all arrays that are written to a PDF file.
  *  
@@ -56,12 +54,16 @@ typedef std::vector<PdfObject> PdfArrayBaseClass;
  *
  *  \see PdfVariant
  */
-class PODOFO_API PdfArray : private PdfArrayBaseClass, public PdfDataType {
+class PODOFO_API PdfArray : public PdfOwnedDataType {
  public:
-    typedef PdfArrayBaseClass::iterator               iterator;
-    typedef PdfArrayBaseClass::const_iterator         const_iterator;
-    typedef PdfArrayBaseClass::reverse_iterator       reverse_iterator;
-    typedef PdfArrayBaseClass::const_reverse_iterator const_reverse_iterator;
+    typedef size_t                                          size_type;
+    typedef PdfObject                                       value_type;
+    typedef value_type &                                    reference;
+    typedef const value_type &                              const_reference;
+    typedef std::vector<value_type>::iterator               iterator;
+    typedef std::vector<value_type>::const_iterator         const_iterator;
+    typedef std::vector<value_type>::reverse_iterator       reverse_iterator;
+    typedef std::vector<value_type>::const_reverse_iterator const_reverse_iterator;
 
     /** Create an empty array 
      */
@@ -124,6 +126,18 @@ class PODOFO_API PdfArray : private PdfArrayBaseClass, public PdfDataType {
      */
     size_t GetStringIndex( const std::string& cmpString ) const;
 
+    /** Get the object at the given index out of the array.
+     *
+     * Lookup in the indirect objects as well, if the shallow object was a reference.
+     * The returned value is a pointer to the internal object in the dictionary
+     * so it MUST not be deleted.
+     *
+     *  \param idx
+     *  \returns pointer to the found value. NULL if the index was out of the boundaries
+     */
+    inline const PdfObject * FindAt( size_type idx ) const;
+    inline PdfObject * FindAt( size_type idx );
+
     /** Adds a PdfObject to the array
      *
      *  \param var add a PdfObject to the array
@@ -133,6 +147,10 @@ class PODOFO_API PdfArray : private PdfArrayBaseClass, public PdfDataType {
      */
     inline void push_back( const PdfObject & var );
 
+    /** Remove all elements from the array
+     */
+    void clear();
+
     /** 
      *  \returns the size of the array
      */
@@ -148,9 +166,10 @@ class PODOFO_API PdfArray : private PdfArrayBaseClass, public PdfDataType {
 
     /**
      * Resize the internal vector.
-     * \param __n new size
+     * \param count new size
+     * \param value refernce value
      */
-    inline void resize(size_t __n, value_type __x = PdfArrayBaseClass::value_type());
+    void resize( size_t count, value_type val = value_type() );
     
     /**
      *  Returns a read/write iterator that points to the first
@@ -219,10 +238,10 @@ class PODOFO_API PdfArray : private PdfArrayBaseClass, public PdfDataType {
                     const _InputIterator& __last);
 #endif
 
-    inline PdfArray::iterator insert(const iterator& __position, const PdfObject & val );
+    iterator insert( const iterator &pos, const PdfObject &val );
 
-    inline void erase( const iterator& pos );
-    inline void erase( const iterator& first, const iterator& last );
+    void erase( const iterator& pos );
+    void erase( const iterator& first, const iterator& last );
 
     inline void reserve(size_type __n);
 
@@ -275,19 +294,31 @@ class PODOFO_API PdfArray : private PdfArrayBaseClass, public PdfDataType {
      */
     virtual void SetDirty( bool bDirty );
 
+ protected:
+     void SetOwner( PdfObject* pOwner );
+
  private:
-    bool         m_bDirty; ///< Indicates if this object was modified after construction
+    PdfObject * findAt(size_type idx) const;
 
+ private:
+    bool         m_bDirty; ///< Indicates if this object was modified after construction
+    std::vector<PdfObject> m_objects;
 };
 
 // -----------------------------------------------------
-// 
+//
 // -----------------------------------------------------
-void PdfArray::Clear() 
+inline const PdfObject * PdfArray::FindAt( size_type idx ) const
 {
-    AssertMutable();
+    return findAt( idx );
+}
 
-    this->clear();
+// -----------------------------------------------------
+//
+// -----------------------------------------------------
+inline PdfObject * PdfArray::FindAt( size_type idx )
+{
+    return findAt( idx );
 }
 
 // -----------------------------------------------------
@@ -295,7 +326,7 @@ void PdfArray::Clear()
 // -----------------------------------------------------
 size_t PdfArray::GetSize() const
 {
-    return this->size();
+    return m_objects.size();
 }
 
 // -----------------------------------------------------
@@ -303,10 +334,15 @@ size_t PdfArray::GetSize() const
 // -----------------------------------------------------
 void PdfArray::push_back( const PdfObject & var )
 {
-    AssertMutable();
+    insert( end(), var );
+}
 
-    PdfArrayBaseClass::push_back( var );
-    m_bDirty = true;
+// -----------------------------------------------------
+// 
+// -----------------------------------------------------
+void PdfArray::Clear()
+{
+    clear();
 }
 
 // -----------------------------------------------------
@@ -314,7 +350,7 @@ void PdfArray::push_back( const PdfObject & var )
 // -----------------------------------------------------
 size_t PdfArray::size() const
 {
-    return PdfArrayBaseClass::size();
+    return m_objects.size();
 }
 
 // -----------------------------------------------------
@@ -322,7 +358,7 @@ size_t PdfArray::size() const
 // -----------------------------------------------------
 bool PdfArray::empty() const
 {
-    return PdfArrayBaseClass::empty();
+    return m_objects.empty();
 }
 
 // -----------------------------------------------------
@@ -332,7 +368,7 @@ PdfObject& PdfArray::operator[](size_type __n)
 {
     AssertMutable();
 
-    return PdfArrayBaseClass::operator[](__n);
+    return m_objects[__n];
 }
 
 // -----------------------------------------------------
@@ -340,15 +376,7 @@ PdfObject& PdfArray::operator[](size_type __n)
 // -----------------------------------------------------
 const PdfObject& PdfArray::operator[](size_type __n) const
 {
-    return PdfArrayBaseClass::operator[](__n);
-}
-
-// -----------------------------------------------------
-// 
-// -----------------------------------------------------
-void PdfArray::resize(size_t __n, value_type __x)
-{
-    PdfArrayBaseClass::resize(__n, __x);
+    return m_objects[__n];
 }
 
 // -----------------------------------------------------
@@ -356,7 +384,7 @@ void PdfArray::resize(size_t __n, value_type __x)
 // -----------------------------------------------------
 PdfArray::iterator PdfArray::begin()
 {
-    return PdfArrayBaseClass::begin();
+    return m_objects.begin();
 }
 
 // -----------------------------------------------------
@@ -364,7 +392,7 @@ PdfArray::iterator PdfArray::begin()
 // -----------------------------------------------------
 PdfArray::const_iterator PdfArray::begin() const
 {
-    return PdfArrayBaseClass::begin();
+    return m_objects.begin();
 }
 
 // -----------------------------------------------------
@@ -372,7 +400,7 @@ PdfArray::const_iterator PdfArray::begin() const
 // -----------------------------------------------------
 PdfArray::iterator PdfArray::end()
 {
-    return PdfArrayBaseClass::end();
+    return m_objects.end();
 }
 
 // -----------------------------------------------------
@@ -380,7 +408,7 @@ PdfArray::iterator PdfArray::end()
 // -----------------------------------------------------
 PdfArray::const_iterator PdfArray::end() const
 {
-    return PdfArrayBaseClass::end();
+    return m_objects.end();
 }
 
 // -----------------------------------------------------
@@ -388,7 +416,7 @@ PdfArray::const_iterator PdfArray::end() const
 // -----------------------------------------------------
 PdfArray::reverse_iterator PdfArray::rbegin()
 {
-    return PdfArrayBaseClass::rbegin();
+    return m_objects.rbegin();
 }
 
 // -----------------------------------------------------
@@ -396,7 +424,7 @@ PdfArray::reverse_iterator PdfArray::rbegin()
 // -----------------------------------------------------
 PdfArray::const_reverse_iterator PdfArray::rbegin() const
 {
-    return PdfArrayBaseClass::rbegin();
+    return m_objects.rbegin();
 }
 
 // -----------------------------------------------------
@@ -404,7 +432,7 @@ PdfArray::const_reverse_iterator PdfArray::rbegin() const
 // -----------------------------------------------------
 PdfArray::reverse_iterator PdfArray::rend()
 {
-    return PdfArrayBaseClass::rend();
+    return m_objects.rend();
 }
 
 // -----------------------------------------------------
@@ -412,7 +440,7 @@ PdfArray::reverse_iterator PdfArray::rend()
 // -----------------------------------------------------
 PdfArray::const_reverse_iterator PdfArray::rend() const
 {
-    return PdfArrayBaseClass::rend();
+    return m_objects.rend();
 }
 
 // -----------------------------------------------------
@@ -431,49 +459,27 @@ void PdfArray::insert(const PdfArray::iterator& __position,
 {
     AssertMutable();
 
-    PdfArrayBaseClass::insert( __position, __first, __last );
-    m_bDirty = true;
-}
-
-// -----------------------------------------------------
-// 
-// -----------------------------------------------------
-PdfArray::iterator PdfArray::insert(const iterator& __position, const PdfObject & val )
-{
-    AssertMutable();
+    PdfVecObjects *pOwner = GetObjectOwner();
+    iterator it1 = __first;
+    iterator it2 = __position;
+    for ( ; it1 != __last; it1++, it2++ )
+    {
+        it2 = m_objects.insert( it2, *it1 );
+        if ( pOwner != NULL )
+            it2->SetOwner( pOwner );
+    }
 
     m_bDirty = true;
-    return PdfArrayBaseClass::insert( __position, val );
 }
 
 // -----------------------------------------------------
 // 
 // -----------------------------------------------------
-void PdfArray::erase( const iterator& pos )
+void PdfArray::reserve( size_type __n )
 {
     AssertMutable();
 
-    PdfArrayBaseClass::erase( pos );
-    m_bDirty = true;
-}
-
-// -----------------------------------------------------
-// 
-// -----------------------------------------------------
-void PdfArray::erase( const iterator& first, const iterator& last )
-{
-    AssertMutable();
-
-    PdfArrayBaseClass::erase( first, last );
-    m_bDirty = true;
-}
-
-// -----------------------------------------------------
-// 
-// -----------------------------------------------------
-void PdfArray::reserve(size_type __n)
-{
-    PdfArrayBaseClass::reserve( __n );
+    m_objects.reserve( __n );
 }
 
 // -----------------------------------------------------
@@ -481,7 +487,7 @@ void PdfArray::reserve(size_type __n)
 // -----------------------------------------------------
 PdfObject & PdfArray::front()
 {
-    return PdfArrayBaseClass::front();
+    return m_objects.front();
 }
 
 // -----------------------------------------------------
@@ -489,7 +495,7 @@ PdfObject & PdfArray::front()
 // -----------------------------------------------------
 const PdfObject & PdfArray::front() const
 {
-    return PdfArrayBaseClass::front();
+    return m_objects.front();
 }
 
 // -----------------------------------------------------
@@ -497,7 +503,7 @@ const PdfObject & PdfArray::front() const
 // -----------------------------------------------------
 PdfObject & PdfArray::back()
 {
-    return PdfArrayBaseClass::back();
+    return m_objects.back();
 }
       
 // -----------------------------------------------------
@@ -505,7 +511,7 @@ PdfObject & PdfArray::back()
 // -----------------------------------------------------
 const PdfObject & PdfArray::back() const
 {
-    return PdfArrayBaseClass::back();
+    return m_objects.back();
 }
 
 // -----------------------------------------------------
@@ -514,7 +520,7 @@ const PdfObject & PdfArray::back() const
 bool PdfArray::operator==( const PdfArray & rhs ) const
 {
     //TODO: This operator does not check for m_bDirty. Add comparison or add explanation why it should not be there
-    return (static_cast< PdfArrayBaseClass >(*this) == static_cast< PdfArrayBaseClass >(rhs) );
+    return m_objects == rhs.m_objects;
 }
 
 // -----------------------------------------------------
@@ -523,7 +529,7 @@ bool PdfArray::operator==( const PdfArray & rhs ) const
 bool PdfArray::operator!=( const PdfArray & rhs ) const
 {
     //TODO: This operator does not check for m_bDirty. Add comparison or add explanation why it should not be there
-    return (static_cast< PdfArrayBaseClass >(*this) != static_cast< PdfArrayBaseClass >(rhs) );
+    return m_objects != rhs.m_objects;
 }
 
 typedef PdfArray                 TVariantList;
diff --git a/src/podofo/base/PdfDictionary.cpp b/src/podofo/base/PdfDictionary.cpp
index 0693877..b085c60 100644
--- a/src/podofo/base/PdfDictionary.cpp
+++ b/src/podofo/base/PdfDictionary.cpp
@@ -44,7 +44,7 @@ PdfDictionary::PdfDictionary()
 }
 
 PdfDictionary::PdfDictionary( const PdfDictionary & rhs )
-    : PdfDataType()
+    : PdfOwnedDataType()
 {
     this->operator=( rhs );
     m_bDirty = false;
@@ -68,7 +68,8 @@ const PdfDictionary & PdfDictionary::operator=( const PdfDictionary & rhs )
         m_mapKeys[(*it).first] = new PdfObject( *(*it).second );
         ++it;
     }
-    
+
+    PdfOwnedDataType::operator=( rhs );
     m_bDirty = true;
     return *this;
 }
@@ -147,6 +148,9 @@ void PdfDictionary::AddKey( const PdfName & identifier, const PdfObject & rObjec
         inserted.first->second = objToInsert;
     }
 
+    PdfVecObjects *pOwner = GetObjectOwner();
+    if ( pOwner != NULL )
+        inserted.first->second->SetOwner( pOwner );
     m_bDirty = true;
 }
 
@@ -155,7 +159,7 @@ void PdfDictionary::AddKey( const PdfName & identifier, const PdfObject* pObject
     this->AddKey( identifier, *pObject );
 }
 
-const PdfObject* PdfDictionary::GetKey( const PdfName & key ) const
+PdfObject * PdfDictionary::getKey( const PdfName & key ) const
 {
     if( !key.GetLength() )
         return NULL;
@@ -170,19 +174,42 @@ const PdfObject* PdfDictionary::GetKey( const PdfName & key ) const
     return (*it).second;
 }
 
-PdfObject* PdfDictionary::GetKey( const PdfName & key )
+PdfObject * PdfDictionary::findKey( const PdfName &key ) const
 {
-    if( !key.GetLength() )
-        return NULL;
-
-    TIKeyMap it;
-
-    it = m_mapKeys.find( key );
+    PdfObject *obj = getKey( key );
+    if ( obj != NULL )
+    {
+        if ( obj->IsReference() )
+            return GetIndirectObject( obj->GetReference() );
+        else
+            return obj;
+    }
 
-    if( it == m_mapKeys.end() )
-        return NULL;
+    return NULL;
+}
 
-    return (*it).second;
+PdfObject * PdfDictionary::findKeyParent( const PdfName & key ) const
+{
+    PdfObject *obj = findKey( key );
+    if (obj == NULL)
+    {
+        PdfObject *parent = findKey( "Parent" );
+        if ( parent == NULL )
+        {
+            return NULL;
+        }
+        else
+        {
+            if ( parent->IsDictionary() )
+                return parent->GetDictionary().findKeyParent( key );
+            else
+                return NULL;
+        }
+    }
+    else
+    {
+        return obj;
+    }
 }
 
 pdf_int64 PdfDictionary::GetKeyAsLong( const PdfName & key, pdf_int64 lDefault ) const
@@ -367,4 +394,18 @@ TCIKeyMap PdfDictionary::end() const
     return m_mapKeys.end();
 }
 
+void PdfDictionary::SetOwner( PdfObject *pOwner )
+{
+    PdfOwnedDataType::SetOwner( pOwner );
+    PdfVecObjects *pVecOwner = pOwner->GetOwner();
+    if ( pVecOwner != NULL )
+    {
+        // Set owmership for all children
+        TCIKeyMap it = this->begin();
+        TCIKeyMap end = this->end();
+        for ( ; it != end; it++ )
+            it->second->SetOwner( pVecOwner );
+    }
+}
+
 };
diff --git a/src/podofo/base/PdfDictionary.h b/src/podofo/base/PdfDictionary.h
index 342d4fc..373bc79 100644
--- a/src/podofo/base/PdfDictionary.h
+++ b/src/podofo/base/PdfDictionary.h
@@ -35,7 +35,7 @@
 #define _PDF_DICTIONARY_H_
 
 #include "PdfDefines.h"
-#include "PdfDataType.h"
+#include "PdfOwnedDataType.h"
 
 #include "PdfName.h"
 #include "PdfObject.h"
@@ -86,7 +86,7 @@ class PdfOutputDevice;
 /** The PDF dictionary data type of PoDoFo (inherits from PdfDataType,
  *  the base class for such representations)
  */
-class PODOFO_API PdfDictionary : public PdfDataType {
+class PODOFO_API PdfDictionary : public PdfOwnedDataType {
  public:
     /** Create a new, empty dictionary
      */
@@ -165,7 +165,7 @@ class PODOFO_API PdfDictionary : public PdfDataType {
      * 
      *  \returns pointer to the found value, or 0 if the key was not found.
      */
-    const PdfObject* GetKey( const PdfName & key ) const;
+    inline const PdfObject* GetKey( const PdfName & key ) const;
 
     /** Get the key's value out of the dictionary.  This is an overloaded member
      * function.
@@ -178,7 +178,32 @@ class PODOFO_API PdfDictionary : public PdfDataType {
      * 
      *  \returns the found value, or 0 if the key was not found.
      */
-    PdfObject* GetKey( const PdfName & key );
+    inline PdfObject* GetKey( const PdfName & key );
+
+    /** Get the keys value out of the dictionary
+     *
+     * Lookup in the indirect objects as well, if the shallow object was a reference.
+     * The returned value is a pointer to the internal object in the dictionary
+     * so it MUST not be deleted.
+     *
+     *  \param key look for the key names pszKey in the dictionary
+     *  \returns pointer to the found value or 0 if the key was not found.
+     */
+    inline const PdfObject* FindKey( const PdfName & key ) const;
+    inline PdfObject* FindKey( const PdfName & key );
+
+    /** Get the keys value out of the dictionary
+     *
+     * Lookup in the indirect objects as well, if the shallow object was a reference.
+     * Also lookup the parent objects, if /Parent key is found in the dictionary.
+     * The returned value is a pointer to the internal object in the dictionary
+     * so it MUST not be deleted.
+     *
+     *  \param key look for the key names pszKey in the dictionary
+     *  \returns pointer to the found value or 0 if the key was not found.
+     */
+    inline const PdfObject* FindKeyParent( const PdfName & key ) const;
+    inline PdfObject* FindKeyParent( const PdfName & key );
 
     /** Get the key's value out of the dictionary.
      *
@@ -286,6 +311,14 @@ class PODOFO_API PdfDictionary : public PdfDataType {
      TCIKeyMap begin() const;
      TCIKeyMap end() const;
 
+ protected:
+     void SetOwner( PdfObject* pOwner );
+
+ private:
+     PdfObject * getKey(const PdfName & key) const;
+     PdfObject * findKey(const PdfName & key) const;
+     PdfObject * findKeyParent(const PdfName & key) const;
+
  private: 
     TKeyMap      m_mapKeys; 
 
@@ -296,6 +329,57 @@ typedef std::vector<PdfDictionary*>      TVecDictionaries;
 typedef	TVecDictionaries::iterator       TIVecDictionaries; 
 typedef	TVecDictionaries::const_iterator TCIVecDictionaries;
 
+// -----------------------------------------------------
+//
+// -----------------------------------------------------
+inline const PdfObject * PdfDictionary::GetKey( const PdfName &key ) const
+{
+    return getKey(key);
+}
+
+// -----------------------------------------------------
+//
+// -----------------------------------------------------
+inline PdfObject * PdfDictionary::GetKey( const PdfName &key )
+{
+    return getKey(key);
+}
+
+// -----------------------------------------------------
+//
+// -----------------------------------------------------
+inline const PdfObject * PdfDictionary::FindKey( const PdfName &key ) const
+{
+    return findKey(key);
+}
+
+// -----------------------------------------------------
+//
+// -----------------------------------------------------
+inline PdfObject * PdfDictionary::FindKey( const PdfName &key )
+{
+    return findKey(key);
+}
+
+// -----------------------------------------------------
+//
+// -----------------------------------------------------
+inline const PdfObject* PdfDictionary::FindKeyParent( const PdfName &key ) const
+{
+    return findKeyParent(key);
+}
+
+// -----------------------------------------------------
+//
+// -----------------------------------------------------
+inline PdfObject* PdfDictionary::FindKeyParent( const PdfName &key )
+{
+    return findKeyParent(key);
+}
+
+// -----------------------------------------------------
+//
+// -----------------------------------------------------
 size_t PdfDictionary::GetSize() const
 {
     return m_mapKeys.size();
diff --git a/src/podofo/base/PdfObject.cpp b/src/podofo/base/PdfObject.cpp
index 91e8aff..b7d83df 100644
--- a/src/podofo/base/PdfObject.cpp
+++ b/src/podofo/base/PdfObject.cpp
@@ -126,6 +126,8 @@ PdfObject::PdfObject( const PdfDictionary & rDict )
     InitPdfObject();
 }
 
+// NOTE: Don't copy owner. Copied objects must be always detached.
+// Ownership will be set automatically elsewhere
 PdfObject::PdfObject( const PdfObject & rhs ) 
     : PdfVariant( rhs ), m_reference( rhs.m_reference )
 {
@@ -137,8 +139,12 @@ PdfObject::PdfObject( const PdfObject & rhs )
     const_cast<PdfObject*>(&rhs)->DelayedStreamLoad();
     m_bDelayedStreamLoadDone = rhs.DelayedStreamLoadDone();
 
-    if( rhs.m_pStream && m_pOwner )
-        m_pStream = m_pOwner->CreateStream( *(rhs.m_pStream) );
+    // FIXME:
+    // Copying stream is currently broken:
+    // 1) PdfVecObjects::CreateStream( const PdfStream & ) is broken as it just returns NULL
+    // 2) Stream should be copyable also when m_pOwner is NULL (which is the case for copy constructor)
+    //if( rhs.m_pStream && m_pOwner )
+    //    m_pStream = m_pOwner->CreateStream( *(rhs.m_pStream) );
 
 #if defined(PODOFO_EXTRA_CHECKS)
     // Must've been demand loaded or already done
@@ -153,12 +159,46 @@ PdfObject::~PdfObject()
     m_pStream = NULL;
 }
 
+void PdfObject::SetOwner( PdfVecObjects* pVecObjects )
+{
+    PODOFO_ASSERT( pVecObjects != NULL );
+    if ( m_pOwner == pVecObjects )
+    {
+        // The inner owner for variant data objects is guaranteed to be same
+        return;
+    }
+
+    m_pOwner = pVecObjects;
+    if ( DelayedLoadDone() )
+        SetVariantOwner( GetDataType() );
+}
+
+void PdfObject::AfterDelayedLoad( EPdfDataType eDataType )
+{
+    SetVariantOwner( eDataType );
+}
+
+void PdfObject::SetVariantOwner( EPdfDataType eDataType )
+{
+    switch ( eDataType )
+    {
+        case ePdfDataType_Dictionary:
+            static_cast<PdfOwnedDataType &>( GetDictionary_NoDL() ).SetOwner( this );
+            break;
+        case ePdfDataType_Array:
+            static_cast<PdfOwnedDataType &>( GetArray_NoDL() ).SetOwner( this );
+            break;
+        default:
+            break;
+    }
+}
+
 void PdfObject::InitPdfObject()
 {
     m_pStream                 = NULL;
     m_pOwner                  = NULL;
-
     m_bDelayedStreamLoadDone  = true;
+    SetVariantOwner( GetDataType() );
 
 #if defined(PODOFO_EXTRA_CHECKS)
     m_bDelayedStreamLoadInProgress = false;
@@ -221,26 +261,11 @@ void PdfObject::WriteObject( PdfOutputDevice* pDevice, EPdfWriteMode eWriteMode,
 
 PdfObject* PdfObject::GetIndirectKey( const PdfName & key ) const
 {
-    const PdfObject* pObj = NULL;
-
-    if( this->IsDictionary() && this->GetDictionary().HasKey( key ) )
-    {
-        pObj = this->GetDictionary().GetKey( key );
-        if( pObj->IsReference() ) 
-        {
-            if( !m_pOwner )
-            {
-                PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidHandle, "Object is a reference but does not have an owner!" );
-            }
-
-            pObj = m_pOwner->GetObject( pObj->GetReference() );
-        }
-        else
-            const_cast<PdfObject*>(pObj)->SetOwner( GetOwner() );// even directs might want an owner...
-    }
+    if ( !this->IsDictionary() )
+        return NULL;
 
     // DominikS: TODO Remove const on GetIndirectKey
-    return const_cast<PdfObject*>(pObj);
+    return const_cast<PdfObject*>( this->GetDictionary().FindKey( key ) );
 }
 
 pdf_long PdfObject::GetObjectLength( EPdfWriteMode eWriteMode )
@@ -314,15 +339,18 @@ const PdfObject & PdfObject::operator=( const PdfObject & rhs )
 
     const_cast<PdfObject*>(&rhs)->DelayedStreamLoad();
 
+    // NOTE: Don't copy owner. Objects being assigned always keep current ownership
+    PdfVariant::operator=(rhs);
     m_reference     = rhs.m_reference;
-    m_pOwner        = rhs.m_pOwner;
-
-    PdfVariant::operator=( rhs );
-
     m_bDelayedStreamLoadDone = rhs.DelayedStreamLoadDone();
-
-    if( rhs.m_pStream )
-        m_pStream = m_pOwner->CreateStream( *(rhs.m_pStream) );
+    SetVariantOwner( GetDataType() );
+
+    // FIXME:
+    // Copying stream is currently broken:
+    // 1) PdfVecObjects::CreateStream( const PdfStream & ) is broken as it just returns NULL
+    // 2) Stream should be copyable also when m_pOwner is NULL
+    //if( rhs.m_pStream )
+    //    m_pStream = m_pOwner->CreateStream( *(rhs.m_pStream) );
 
 #if defined(PODOFO_EXTRA_CHECKS)
     // Must've been demand loaded or already done
diff --git a/src/podofo/base/PdfObject.h b/src/podofo/base/PdfObject.h
index 6184db1..f895245 100644
--- a/src/podofo/base/PdfObject.h
+++ b/src/podofo/base/PdfObject.h
@@ -48,6 +48,9 @@ class PdfObject;
 class PdfOutputDevice;
 class PdfStream;
 class PdfVecObjects;
+class PdfDictionary;
+class PdfArray;
+class PdfDocument;
 
 /**
  * This class represents a PDF indirect Object in memory
@@ -63,6 +66,9 @@ class PdfVecObjects;
  */
 class PODOFO_API PdfObject : public PdfVariant {
     friend class PdfVecObjects;
+    friend class PdfArray;
+    friend class PdfDictionary;
+    friend class PdfDocument;
 
  public:
 
@@ -234,13 +240,6 @@ class PODOFO_API PdfObject : public PdfVariant {
      */
     PODOFO_NOTHROW inline bool operator==( const PdfObject & rhs ) const;
 
-    /** Set the owner of this object, i.e. the PdfVecObjects instance to which
-     *  this object belongs.
-     *
-     *  \param pVecObjects a vector of PDF objects
-     */
-    inline void SetOwner( PdfVecObjects* pVecObjects );
-
     /** Get the owner of this object.
      *  \return the owner (if it wasn't changed anywhere, creator) of this object
      */
@@ -318,6 +317,20 @@ class PODOFO_API PdfObject : public PdfVariant {
      */
     PdfStream* GetStream_NoDL();
 
+    virtual void AfterDelayedLoad( EPdfDataType eDataType );
+
+    /** Set the owner of this object variant
+     */
+    void SetVariantOwner( EPdfDataType eDataType );
+
+ private:
+     /** Set the owner of this object, i.e. the PdfVecObjects to which
+      *  this object belongs.
+      *
+      *  \param pVecObjects a vector of pdf objects
+      */
+     void SetOwner(PdfVecObjects* pVecObjects);
+
  private:
     /* See PdfVariant.h for a detailed explanation of this member, which is
      * here to prevent accidental construction of a PdfObject of integer type
@@ -378,14 +391,6 @@ const PdfReference & PdfObject::Reference() const
     return m_reference;
 }
 
-// -----------------------------------------------------
-// 
-// -----------------------------------------------------
-inline void PdfObject::SetOwner( PdfVecObjects* pVecObjects )
-{
-    m_pOwner = pVecObjects;
-}
-
 // -----------------------------------------------------
 // 
 // -----------------------------------------------------
diff --git a/src/podofo/base/PdfOwnedDataType.cpp b/src/podofo/base/PdfOwnedDataType.cpp
new file mode 100644
index 0000000..d66c033
--- /dev/null
+++ b/src/podofo/base/PdfOwnedDataType.cpp
@@ -0,0 +1,78 @@
+/***************************************************************************
+ *   Copyright (C) 2006 by Dominik Seichter                                *
+ *   [email protected]                                                    *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU Library General Public License as       *
+ *   published by the Free Software Foundation; either version 2 of the    *
+ *   License, or (at your option) any later version.                       *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU Library General Public     *
+ *   License along with this program; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *                                                                         *
+ *   In addition, as a special exception, the copyright holders give       *
+ *   permission to link the code of portions of this program with the      *
+ *   OpenSSL library under certain conditions as described in each         *
+ *   individual source file, and distribute linked combinations            *
+ *   including the two.                                                    *
+ *   You must obey the GNU General Public License in all respects          *
+ *   for all of the code used other than OpenSSL.  If you modify           *
+ *   file(s) with this exception, you may extend this exception to your    *
+ *   version of the file(s), but you are not obligated to do so.  If you   *
+ *   do not wish to do so, delete this exception statement from your       *
+ *   version.  If you delete this exception statement from all source      *
+ *   files in the program, then also delete it here.                       *
+ ***************************************************************************/
+
+#include "PdfOwnedDataType.h"
+#include "PdfObject.h"
+#include "PdfVecObjects.h"
+
+namespace PoDoFo {
+
+PdfOwnedDataType::PdfOwnedDataType()
+    : m_pOwner( NULL )
+{
+}
+
+// NOTE: Don't copy owner. Copied objects must be always detached.
+// Ownership will be set automatically elsewhere
+PdfOwnedDataType::PdfOwnedDataType( const PdfOwnedDataType &rhs )
+    : PdfDataType( rhs ), m_pOwner( NULL )
+{
+}
+
+PdfObject * PdfOwnedDataType::GetIndirectObject( const PdfReference &rReference ) const
+{
+    if ( m_pOwner == NULL )
+        PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidHandle, "Object is a reference but does not have an owner!" );
+
+    return m_pOwner->GetOwner()->GetObject( rReference );
+}
+
+void PdfOwnedDataType::SetOwner( PdfObject* pOwner )
+{
+    PODOFO_ASSERT( pOwner != NULL );
+    m_pOwner = pOwner;
+}
+
+PdfOwnedDataType & PdfOwnedDataType::operator=( const PdfOwnedDataType & rhs )
+{
+    // NOTE: Don't copy owner. Objects being assigned will keep current ownership
+    PdfDataType::operator=( rhs );
+    return *this;
+}
+
+PdfVecObjects * PdfOwnedDataType::GetObjectOwner()
+{
+    return m_pOwner == NULL ? NULL : m_pOwner->GetOwner();
+}
+
+};
diff --git a/src/podofo/base/PdfOwnedDataType.h b/src/podofo/base/PdfOwnedDataType.h
new file mode 100644
index 0000000..9843914
--- /dev/null
+++ b/src/podofo/base/PdfOwnedDataType.h
@@ -0,0 +1,90 @@
+/***************************************************************************
+ *   Copyright (C) 2006 by Dominik Seichter                                *
+ *   [email protected]                                                    *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU Library General Public License as       *
+ *   published by the Free Software Foundation; either version 2 of the    *
+ *   License, or (at your option) any later version.                       *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU Library General Public     *
+ *   License along with this program; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *                                                                         *
+ *   In addition, as a special exception, the copyright holders give       *
+ *   permission to link the code of portions of this program with the      *
+ *   OpenSSL library under certain conditions as described in each         *
+ *   individual source file, and distribute linked combinations            *
+ *   including the two.                                                    *
+ *   You must obey the GNU General Public License in all respects          *
+ *   for all of the code used other than OpenSSL.  If you modify           *
+ *   file(s) with this exception, you may extend this exception to your    *
+ *   version of the file(s), but you are not obligated to do so.  If you   *
+ *   do not wish to do so, delete this exception statement from your       *
+ *   version.  If you delete this exception statement from all source      *
+ *   files in the program, then also delete it here.                       *
+ ***************************************************************************/
+
+#ifndef _PDF_OWNED_DATATYPE_H_
+#define _PDF_OWNED_DATATYPE_H_
+
+#include "PdfDataType.h"
+
+namespace PoDoFo {
+
+class PdfObject;
+class PdfVecObjects;
+class PdfReference;
+
+/**
+ * A PdfDataType object with PdfObject owner
+ */
+class PODOFO_API PdfOwnedDataType : public PdfDataType {
+    friend class PdfObject;
+protected:
+    /** Create a new PdfDataOwnedType.
+     *  Can only be called by subclasses
+     */
+    PdfOwnedDataType();
+
+    PdfOwnedDataType( const PdfOwnedDataType &rhs );
+
+public:
+
+    /** \returns a pointer to a PdfVecObjects that is the
+     *           owner of this data type.
+     *           Might be NULL if the data type has no owner.
+     */
+    inline const PdfObject* GetOwner() const;
+    inline PdfObject* GetOwner();
+
+    PdfOwnedDataType & operator=( const PdfOwnedDataType &rhs );
+
+protected:
+    PdfObject * GetIndirectObject( const PdfReference &rReference ) const;
+    PdfVecObjects * GetObjectOwner();
+    virtual void SetOwner( PdfObject *pOwner );
+
+private:
+    PdfObject *m_pOwner;
+};
+
+inline const PdfObject* PdfOwnedDataType::GetOwner() const
+{
+    return m_pOwner;
+}
+
+inline PdfObject* PdfOwnedDataType::GetOwner()
+{
+    return m_pOwner;
+}
+
+}; // namespace PoDoFo
+
+#endif /* _PDF_OWNED_DATATYPE_H_ */
diff --git a/src/podofo/base/PdfVariant.h b/src/podofo/base/PdfVariant.h
index 4761f69..f360827 100644
--- a/src/podofo/base/PdfVariant.h
+++ b/src/podofo/base/PdfVariant.h
@@ -436,6 +436,11 @@ class PODOFO_API PdfVariant {
      */
     inline virtual void DelayedLoadImpl();
 
+    /** Called after delayed load
+     *  \param eDataType Detected data type
+     */
+    inline virtual void AfterDelayedLoad( EPdfDataType eDataType );
+
     /**
      * Returns true if delayed loading is disabled, or if it is enabled
      * and loading has completed. External callers should never need to
@@ -564,6 +569,7 @@ inline void PdfVariant::DelayedLoad() const
 #if defined(PODOFO_EXTRA_CHECKS)
         m_bDelayedLoadInProgress = false;
 #endif
+        const_cast<PdfVariant*>(this)->AfterDelayedLoad( ( EPdfDataType )m_eDataType );
     }
 }
 
@@ -942,6 +948,15 @@ void PdfVariant::DelayedLoadImpl()
     PODOFO_RAISE_ERROR( ePdfError_InternalLogic );
 }
 
+// -----------------------------------------------------
+//
+// -----------------------------------------------------
+void PdfVariant::AfterDelayedLoad( EPdfDataType eDataType )
+{
+    ( void )eDataType;
+    // Do nothing
+}
+
 // -----------------------------------------------------
 // 
 // -----------------------------------------------------
diff --git a/src/podofo/doc/PdfFontFactory.cpp b/src/podofo/doc/PdfFontFactory.cpp
index 12a908c..02d75e8 100644
--- a/src/podofo/doc/PdfFontFactory.cpp
+++ b/src/podofo/doc/PdfFontFactory.cpp
@@ -212,18 +212,29 @@ PdfFont* PdfFontFactory::CreateFont( FT_Library*, PdfObject* pObject )
     const PdfName & rSubType = pSubTypeKey->GetName();
     if( rSubType == PdfName("Type0") ) 
     {
+        // TABLE 5.18 Entries in a Type 0 font dictionary
+
         // The PDF reference states that DescendantFonts must be an array,
         // some applications (e.g. MS Word) put the array into an indirect object though.
-        const PdfArray & descendant  = 
+        PdfArray & descendants  =
             pObject->GetIndirectKey( "DescendantFonts" )->GetArray();
         PdfObject* pFontObject = NULL;
         
-        if (descendant.size() && descendant[0].IsReference())
+        if ( descendants.size() )
         {
-            pFontObject = pObject->GetOwner()->GetObject( descendant[0].GetReference() );
-
+            // DescendantFonts is an one-element array
+            PdfObject &descendant = descendants[0];
+            if ( descendant.IsReference() )
+            {
+                pFontObject = pObject->GetOwner()->GetObject( descendant.GetReference() );
+                pDescriptor = pFontObject->GetIndirectKey( "FontDescriptor" );
+            }
+            else
+            {
+                pFontObject = &descendant;
             pDescriptor = pFontObject->GetIndirectKey( "FontDescriptor" );
         }
+        }
         pEncoding   = pObject->GetIndirectKey( "Encoding" );
 
         if ( pEncoding && pDescriptor ) // OC 18.08.2010: Avoid sigsegv
diff --git a/src/podofo/doc/PdfPage.cpp b/src/podofo/doc/PdfPage.cpp
index dd8f4cb..ac55ff5 100644
--- a/src/podofo/doc/PdfPage.cpp
+++ b/src/podofo/doc/PdfPage.cpp
@@ -728,11 +728,7 @@ PdfObject* PdfPage::GetOwnAnnotationsArray( bool bCreate, PdfDocument *pDocument
             }
 
             pObj = pDocument->GetObjects()->GetObject( pObj->GetReference() );
-            if(pObj) {
-               pObj->SetOwner(this->GetObject()->GetOwner());
-            }
-         } else
-            pObj->SetOwner( this->GetObject()->GetOwner() );// even directs might want an owner...
+         }
       }
 
       if( pObj && pObj->IsArray() )
diff --git a/src/podofo/doc/PdfShadingPattern.cpp b/src/podofo/doc/PdfShadingPattern.cpp
index 9527511..8a91f4c 100644
--- a/src/podofo/doc/PdfShadingPattern.cpp
+++ b/src/podofo/doc/PdfShadingPattern.cpp
@@ -186,7 +186,6 @@ void PdfShadingPattern::Init( EPdfShadingPatternType eShadingType )
 	 } else {
 		 PdfObject *shadingObject = this->GetObject()->GetOwner()->CreateObject(shading);
 		 this->GetObject()->GetDictionary().AddKey(PdfName("Shading"), shadingObject->Reference());
-		 this->GetObject()->GetDictionary().GetKey(PdfName("Shading"))->SetOwner(this->GetObject()->GetOwner());
 	 }
 }
 
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to