From 0a49103801e322656eeacf8764cc0cb557059cea Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Fri, 22 Jun 2018 15:24:05 +0000 Subject: CPDF_PageObjectHolder::GetDirtyStreams() returns const ref. This is safer since a ref cannot be deleted. Change-Id: Ib8d76ae2adb7c59e6955881eee0d2bd4db448b68 Reviewed-on: https://pdfium-review.googlesource.com/35950 Reviewed-by: Ryan Harrison Commit-Queue: Henrique Nakashima --- core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp | 6 +++--- core/fpdfapi/edit/cpdf_pagecontentmanager.cpp | 2 +- core/fpdfapi/page/cpdf_pageobjectholder.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp index da6c74e2c7..ba31516f4a 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp @@ -85,10 +85,10 @@ CPDF_PageContentGenerator::GenerateModifiedStreams() { if (pPageObj->IsDirty()) all_dirty_streams.insert(pPageObj->GetContentStream()); } - const std::set* marked_dirty_streams = + const std::set& marked_dirty_streams = m_pObjHolder->GetDirtyStreams(); - all_dirty_streams.insert(marked_dirty_streams->begin(), - marked_dirty_streams->end()); + all_dirty_streams.insert(marked_dirty_streams.begin(), + marked_dirty_streams.end()); // Start regenerating dirty streams. std::map> streams; diff --git a/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp b/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp index 46033bc0d1..3ba23a88fb 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp @@ -101,7 +101,7 @@ void CPDF_PageContentManager::ExecuteScheduledRemovals() { // updated. // Since this is only called by CPDF_PageContentGenerator::GenerateContent(), // which cleans up the dirty streams first, this should always be true. - ASSERT(obj_holder_->GetDirtyStreams()->empty()); + ASSERT(obj_holder_->GetDirtyStreams().empty()); if (contents_stream_) { // Only stream that can be removed is 0. diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h index d18f400568..b1f7fb9e7f 100644 --- a/core/fpdfapi/page/cpdf_pageobjectholder.h +++ b/core/fpdfapi/page/cpdf_pageobjectholder.h @@ -85,7 +85,7 @@ class CPDF_PageObjectHolder { void AddImageMaskBoundingBox(const CFX_FloatRect& box); void Transform(const CFX_Matrix& matrix); CFX_FloatRect CalcBoundingBox() const; - const std::set* GetDirtyStreams() const { return &m_DirtyStreams; } + const std::set& GetDirtyStreams() const { return m_DirtyStreams; } void ClearDirtyStreams() { m_DirtyStreams.clear(); } UnownedPtr m_pPageResources; -- cgit v1.2.3