From 7df950ac2ef484880fe3cbfb9961bed34fee191d Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 26 Oct 2018 19:42:40 +0000 Subject: Stop transfering ownership of |this| as CPWL_Wnd::Create() side-effect Instead, make it an explicit method called on the parent outside of create. Rename Create() to Realize() to be sure to catch all usages, and add the new required call. Attachment to the parent now takes place a little earlier on in the life-cycle as a result but should be ok. Precursor to converting to smart pointers. Change-Id: I45c459fcd28b5d03c428ce5809d0432506cf4ec6 Reviewed-on: https://pdfium-review.googlesource.com/c/44690 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- fpdfsdk/formfiller/cffl_pushbutton.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fpdfsdk/formfiller/cffl_pushbutton.cpp') diff --git a/fpdfsdk/formfiller/cffl_pushbutton.cpp b/fpdfsdk/formfiller/cffl_pushbutton.cpp index 04db191572..4c9a1ed4cb 100644 --- a/fpdfsdk/formfiller/cffl_pushbutton.cpp +++ b/fpdfsdk/formfiller/cffl_pushbutton.cpp @@ -21,6 +21,8 @@ std::unique_ptr CFFL_PushButton::NewPWLWindow( const CPWL_Wnd::CreateParams& cp, std::unique_ptr pAttachedData) { auto pWnd = pdfium::MakeUnique(std::move(pAttachedData)); - pWnd->Create(cp); + if (cp.pParentWnd) + cp.pParentWnd->AddChild(pWnd.get()); + pWnd->Realize(cp); return std::move(pWnd); } -- cgit v1.2.3