On Mon, 2016-05-09 at 15:25 +0000, Matthew Brincke wrote: > Please review, test and if accepted please apply the patch and commit > separately to the public repository. Please include the info (except > about testing) from the preceding paragraph in the commit message.
Hi, it's still crashing, and the ref_count doesn't help, because what I see is that the Erase() is called with either ref_count being 1 or 0, thus the delete is called regardless this being added. The problem is elsewhere. I added dumps of the outlines tree below into the Yan's code: > static void > outline_crash (void) > { > PdfMemDocument doc; > const PdfMemDocument indoc1("doc1.pdf"); > PdfOutlines *outout = doc.GetOutlines(); > outout->CreateRoot("doc1.pdf"); > PdfOutlineItem *root = doc.GetOutlines()->First(); > doc.InsertPages(indoc1,0,3); > root->SetDestination(PdfDestination(doc.GetPage(0))); dump 1) > PdfOutlineItem *nextroot = root->Next(); > if (nextroot) root->InsertChild(nextroot); > PdfOutlineItem *x = doc.GetOutlines()->First(); dump 2) > x->Erase(); > } The dump 1) shows: item:0x22a0310 prev:(nil) next:0x23013a0 first:(nil) last:(nil) parent:0x229e0b0 item:0x23013a0 prev:0x22a0310 next:0x22da6f0 first:0x2301400 last:(nil) parent:(nil) item:0x2301400 prev:(nil) next:0x22da690 first:(nil) last:(nil) parent:0x23013a0 item:0x22da690 prev:0x2301400 next:(nil) first:(nil) last:(nil) parent:(nil) item:0x22da6f0 prev:0x23013a0 next:(nil) first:0x22da750 last:0x22da750 parent:(nil) item:0x22da750 prev:(nil) next:(nil) first:(nil) last:(nil) parent:0x22da6f0 item:0x22da6f0 prev:0x23013a0 next:(nil) first:0x22da750 last:0x22da750 parent:(nil) item:0x22da750 prev:(nil) next:(nil) first:(nil) last:(nil) parent:0x22da6f0 while the dump 2) shows (just before the Erase() call): item:0x22a0310 prev:(nil) next:0x23013a0 first:0x23013a0 last:0x23013a0 parent:0x229e0b0 item:0x23013a0 prev:0x22a0310 next:0x22da6f0 first:0x2301400 last:(nil) parent:(nil) item:0x2301400 prev:(nil) next:0x22da690 first:(nil) last:(nil) parent:0x23013a0 item:0x22da690 prev:0x2301400 next:(nil) first:(nil) last:(nil) parent:(nil) item:0x22da6f0 prev:0x23013a0 next:(nil) first:0x22da750 last:0x22da750 parent:(nil) item:0x22da750 prev:(nil) next:(nil) first:(nil) last:(nil) parent:0x22da6f0 item:0x23013a0 prev:0x22a0310 next:0x22da6f0 first:0x2301400 last:(nil) parent:(nil) item:0x2301400 prev:(nil) next:0x22da690 first:(nil) last:(nil) parent:0x23013a0 item:0x22da690 prev:0x2301400 next:(nil) first:(nil) last:(nil) parent:(nil) item:0x22da6f0 prev:0x23013a0 next:(nil) first:0x22da750 last:0x22da750 parent:(nil) item:0x22da750 prev:(nil) next:(nil) first:(nil) last:(nil) parent:0x22da6f0 item:0x22da6f0 prev:0x23013a0 next:(nil) first:0x22da750 last:0x22da750 parent:(nil) item:0x22da750 prev:(nil) next:(nil) first:(nil) last:(nil) parent:0x22da6f0 Note that the 'next' and the 'first' members of the root item are the same addresses. That means that the non-PoDoFo code broke the "tree" structure of the outlines. Yan, what are you trying to achieve with that code with the outlines? You see that the manipulation of the tree structure assigns the nodes, it doesn't copy them (memory pointers speaking). Bye, zyx -- http://www.litePDF.cz i...@litepdf.cz ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users