summaryrefslogtreecommitdiff
path: root/fpdfsdk/pwl/cpwl_wnd.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-10-26 22:08:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-26 22:08:43 +0000
commit9590dee526c514d87dc1f47569d1136ffcf539ad (patch)
treeeaea0d3d96ee9248b1cb0dc34fc2950192b7f9ef /fpdfsdk/pwl/cpwl_wnd.cpp
parente027c9765c1aa5ea2a4293fc6ea29a96e3fc2c73 (diff)
downloadpdfium-9590dee526c514d87dc1f47569d1136ffcf539ad.tar.xz
Pass unique_ptr to CPWL_Wnd::AddChild().
But stop short of updating the underlying data structures. Change-Id: I7d8edc74f71725005b81359484d30caddbe958d7 Reviewed-on: https://pdfium-review.googlesource.com/c/44693 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/pwl/cpwl_wnd.cpp')
-rw-r--r--fpdfsdk/pwl/cpwl_wnd.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index 66e5cfa0b6..5522a53972 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -377,10 +377,10 @@ bool CPWL_Wnd::OnMouseWheel(short zDelta,
return false;
}
-void CPWL_Wnd::AddChild(CPWL_Wnd* pWnd) {
+void CPWL_Wnd::AddChild(std::unique_ptr<CPWL_Wnd> pWnd) {
ASSERT(!pWnd->m_pParent);
pWnd->m_pParent = this;
- m_Children.push_back(pWnd);
+ m_Children.push_back(pWnd.release());
}
void CPWL_Wnd::RemoveChild(CPWL_Wnd* pWnd) {
@@ -499,8 +499,10 @@ void CPWL_Wnd::CreateVScrollBar(const CreateParams& cp) {
scp.eCursorType = FXCT_ARROW;
scp.nTransparency = PWL_SCROLLBAR_TRANSPARENCY;
- m_pVScrollBar = new CPWL_ScrollBar(CloneAttachedData(), SBT_VSCROLL);
- AddChild(m_pVScrollBar.Get());
+ auto pBar =
+ pdfium::MakeUnique<CPWL_ScrollBar>(CloneAttachedData(), SBT_VSCROLL);
+ m_pVScrollBar = pBar.get();
+ AddChild(std::move(pBar));
m_pVScrollBar->Realize(scp);
}