• tsepez's avatar
    PDFiumEngine::~PDFiumEngine - Unload() all pages_ before destroying any of them. · 885a59ee
    tsepez authored
    Currently, destroying a PDFiumPage triggers an Unload() which can result
    in an access to other PDFiumPages. But these other pages may already have
    been destroyed as a previous element via STLDeleteElements(&pages_).
    
    Instead, unload all pages first, then destroy them all afterwards so that
    no access to other pages will be attempted after the destruction of the
    first one has begun.
    
    Move the STLDeleteElements() call to the bottom, to make it more closely
    mimic the ordering that might occur should pages_ someday be switched
    from vector to ScopedPtrVector or similar.
    
    BUG=384365
    
    Review URL: https://codereview.chromium.org/544873002
    
    Cr-Commit-Position: refs/heads/master@{#293800}
    885a59ee
pdfium_page.cc 15.1 KB