From 56e5e67fd2ac582dcfa83821c815a0014a43bd10 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 26 May 2017 13:42:15 -0700 Subject: IFX_Pause is passed to CJBig2_Context, no need to store. Avoids the possibility of having a stale pointer in the context. Bug: 726653 Change-Id: I8b41d2ab04e7ab07e694431b53491b3d0861e4ee Reviewed-on: https://pdfium-review.googlesource.com/6074 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fxcodec/codec/fx_codec_jbig.cpp | 2 +- core/fxcodec/jbig2/JBig2_Context.cpp | 8 +++----- core/fxcodec/jbig2/JBig2_Context.h | 2 -- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'core') diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index 7df87e981f..32d030e98d 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -65,7 +65,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( memset(dest_buf, 0, height * dest_pitch); pJbig2Context->m_pContext = pdfium::MakeUnique( global_stream, src_stream, pJBig2DocumentContext->GetSymbolDictCache(), - pPause, false); + false); int ret = pJbig2Context->m_pContext->getFirstPage(dest_buf, width, height, dest_pitch, pPause); return Decode(pJbig2Context, ret); diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index 69a9dd0daa..275c69915c 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -50,20 +50,18 @@ CJBig2_Context::CJBig2_Context( const CFX_RetainPtr& pGlobalStream, const CFX_RetainPtr& pSrcStream, std::list* pSymbolDictCache, - IFX_Pause* pPause, bool bIsGlobal) : m_nSegmentDecoded(0), m_bInPage(false), m_bBufSpecified(false), m_PauseStep(10), - m_pPause(pPause), m_ProcessingStatus(FXCODEC_STATUS_FRAME_READY), m_dwOffset(0), m_pSymbolDictCache(pSymbolDictCache), m_bIsGlobal(bIsGlobal) { - if (pGlobalStream && (pGlobalStream->GetSize() > 0)) { + if (pGlobalStream && pGlobalStream->GetSize() > 0) { m_pGlobalContext = pdfium::MakeUnique( - nullptr, pGlobalStream, pSymbolDictCache, pPause, true); + nullptr, pGlobalStream, pSymbolDictCache, true); } m_pStream = pdfium::MakeUnique(pSrcStream); } @@ -131,7 +129,7 @@ int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) { break; } m_SegmentList.push_back(std::move(pSegment)); - if (pPause && m_pPause && pPause->NeedToPauseNow()) { + if (pPause && pPause->NeedToPauseNow()) { m_PauseStep = 3; m_ProcessingStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; return JBIG2_SUCCESS; diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index 4151fa356e..e4cf33ca96 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -43,7 +43,6 @@ class CJBig2_Context { CJBig2_Context(const CFX_RetainPtr& pGlobalStream, const CFX_RetainPtr& pSrcStream, std::list* pSymbolDictCache, - IFX_Pause* pPause, bool bIsGlobal); ~CJBig2_Context(); @@ -95,7 +94,6 @@ class CJBig2_Context { bool m_bInPage; bool m_bBufSpecified; int32_t m_PauseStep; - CFX_UnownedPtr const m_pPause; FXCODEC_STATUS m_ProcessingStatus; std::vector m_gbContext; std::unique_ptr m_pArithDecoder; -- cgit v1.2.3