From 385d32f64613f08bad5cb63f0b8dc4f847f240f4 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 26 May 2017 13:08:36 -0700 Subject: Fix CPDF_PageRenderContext cleanup Make CFX_RenderDevice, which owns the IFX_RenderDeviceDriver, responsible for restoring driver state as part of its destruction so that its callers don't have to do so out of turn. Then re-order CPDF_PageRenderContext destruction order so that the progressive renderer is destroyed before the device, and the device destroyed before the options because of unowned pointers to objects owned by these. Bug: 726755 Change-Id: I9a6f23da12140b2758b86e6f33f715ad1c679c3f Reviewed-on: https://pdfium-review.googlesource.com/6073 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- fpdfsdk/fpdf_progressive.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdf_progressive.cpp b/fpdfsdk/fpdf_progressive.cpp index fc6ceab38e..2d8f125128 100644 --- a/fpdfsdk/fpdf_progressive.cpp +++ b/fpdfsdk/fpdf_progressive.cpp @@ -88,13 +88,6 @@ DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page, DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page) { CPDF_Page* pPage = CPDFPageFromFPDFPage(page); - if (!pPage) - return; - - CPDF_PageRenderContext* pContext = pPage->GetRenderContext(); - if (!pContext) - return; - - pContext->m_pDevice->RestoreState(false); - pPage->SetRenderContext(nullptr); + if (pPage) + pPage->SetRenderContext(nullptr); } -- cgit v1.2.3