Remove RetainPtr<T>::operator=(T*)
This was hiding one place where we did a .Get() followed by such
an assignment, recreating a RetainPtr<>, which is not optimal. We
use WrapRetain() in the one other spot so exposed.
Change-Id: Idd7ebbf1f27f24ebf877e5e734ec583bd4e01334
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/100672
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index b471b21..d3493de 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -89,7 +89,7 @@
return pObj;
visited.insert(pPageDict);
- pPageDict = pPageDict->GetDictFor(pdfium::page_object::kParent).Get();
+ pPageDict = pPageDict->GetDictFor(pdfium::page_object::kParent);
}
return nullptr;
}
diff --git a/core/fxcrt/retain_ptr.h b/core/fxcrt/retain_ptr.h
index c1c4e4c..329567e 100644
--- a/core/fxcrt/retain_ptr.h
+++ b/core/fxcrt/retain_ptr.h
@@ -67,12 +67,6 @@
return *this;
}
- // Assign a RetainPtr from a raw ptr.
- RetainPtr& operator=(T* that) noexcept {
- Reset(that);
- return *this;
- }
-
// Copy-assign a RetainPtr.
// Required in addition to copy conversion assignment below.
RetainPtr& operator=(const RetainPtr& that) {
diff --git a/core/fxcrt/retain_ptr_unittest.cpp b/core/fxcrt/retain_ptr_unittest.cpp
index 9407fe6..b381e78 100644
--- a/core/fxcrt/retain_ptr_unittest.cpp
+++ b/core/fxcrt/retain_ptr_unittest.cpp
@@ -136,7 +136,7 @@
TEST(RetainPtr, RawAssign) {
PseudoRetainable obj;
RetainPtr<PseudoRetainable> ptr;
- ptr = &obj;
+ ptr = pdfium::WrapRetain(&obj);
EXPECT_EQ(&obj, ptr);
}