Hi zyx, hi all,
Matthew Brincke <ma...@mailbox.org> has written on 28 February 2017 at 00:27:
>
> Hi zyx, hi all,
>
> I'm very sorry to have overlooked that problem with the check
> for an item being in the same tree already.
> I'm still interested in fixing the memory management in that
> class (PdfOutlineItem) and I'd like to submit a patch tomorrow
> or in the coming days, so please hold off on such until then.
I'm sorry that have only build-tested it a bit yet, still I'm submitting
the patch to PdfOutlineItem to correct memory management for review.
Now the item given to InsertChild() is copied and the pointers are set to
NULL so that only that bare item is inserted, no deep copying or problems
with referenced items being reachable/erasable from two different trees.
Please consider review/testing/when appropriate applying to the public
repository.
Best regards, mabri
>
> Best regards, mabri
>
> > zyx <z...@litepdf.cz> has written on 26 February 2017 at 19:59:
> >
> > On Sat, 2016-07-16 at 20:44 +0200, zyx wrote:
> >
> > > On Thu, 2016-07-14 at 23:58 +0000, Matthew Brincke wrote:
> > >
> > > > I haven't changed the check, but documented it can't be deleted at
> > > > its source anymore. If that's too impractical (which it may be),
> > > > please say so and I'll change the check.
> > >
> > > thanks for the update. I committed it as revision 1775:
> > > http://sourceforge.net/p/podofo/code/1775
> >
> > Hi,
> > I realized, when testing PoDoFo 0.9.5, that this change caused
> > a regression, one is not able to create new outlines using
> > PdfOutlineItem::CreateChild(), because it ends with an exception due to
> > the added check. I fixed it with revision 1827:
> > http://sourceforge.net/p/podofo/code/1827
> >
> > Bye,
> > zyx
--- PdfOutlines.h.orig 2017-02-28 21:46:02.788028076 +0000
+++ PdfOutlines.h 2017-03-01 21:45:46.832255248 +0000
@@ -95,9 +95,7 @@ class PODOFO_DOC_API PdfOutlineItem : pu
* would be broken. If this prerequisite is violated, a PdfError
* exception (code ePdfError_OutlineItemAlreadyPresent) is thrown and
* nothing is changed.
- * The item inserted is not copied, i.e. Erase() calls affect the original!
- * Therefore also shared ownership is in effect, i.e. deletion by where it
- * comes from damages the data structure it's inserted into.
+ * The item inserted is copied, and inserted without references to others.
*
* \param pItem an existing outline item
*/
@@ -220,7 +218,7 @@ class PODOFO_DOC_API PdfOutlineItem : pu
void SetLast ( PdfOutlineItem* pItem );
void SetFirst ( PdfOutlineItem* pItem );
- void InsertChildInternal( PdfOutlineItem* pItem, bool bCheckParent );
+ void InsertChildInternal( const PdfOutlineItem* pItem, bool bCheckParent );
protected:
/** Create a new PdfOutlineItem dictionary
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users