summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller/cffl_radiobutton.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-10-24 23:56:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-24 23:56:43 +0000
commit333165a2c7b7812effdea3cd1ae386850cd3f310 (patch)
tree9d3c0757b745bbc3789b282e5aeb931f7a47880e /fpdfsdk/formfiller/cffl_radiobutton.cpp
parent98d1b48e9a3471a02968f3d12692645fa0fcb50d (diff)
downloadpdfium-333165a2c7b7812effdea3cd1ae386850cd3f310.tar.xz
Fix CPLW_Wnd ownership model in CFFL_FormFiller.
CFFL_FormFiller::DestroyPDFWindow() might get re-entered, so do not leave any dangling references in maps. Use unique_ptr to be more sure that we have it right. Bug: chromium:898531 Change-Id: I7b61940ff4e88c8a7e3219fefb0479f33bbbfae1 Reviewed-on: https://pdfium-review.googlesource.com/c/44542 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/formfiller/cffl_radiobutton.cpp')
-rw-r--r--fpdfsdk/formfiller/cffl_radiobutton.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp
index 8105b0cdea..6ce4a0aedc 100644
--- a/fpdfsdk/formfiller/cffl_radiobutton.cpp
+++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp
@@ -6,6 +6,8 @@
#include "fpdfsdk/formfiller/cffl_radiobutton.h"
+#include <utility>
+
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_widget.h"
#include "fpdfsdk/formfiller/cffl_formfiller.h"
@@ -18,11 +20,12 @@ CFFL_RadioButton::CFFL_RadioButton(CPDFSDK_FormFillEnvironment* pApp,
CFFL_RadioButton::~CFFL_RadioButton() {}
-CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) {
- auto* pWnd = new CPWL_RadioButton();
+std::unique_ptr<CPWL_Wnd> CFFL_RadioButton::NewPDFWindow(
+ const CPWL_Wnd::CreateParams& cp) {
+ auto pWnd = pdfium::MakeUnique<CPWL_RadioButton>();
pWnd->Create(cp);
pWnd->SetCheck(m_pWidget->IsChecked());
- return pWnd;
+ return std::move(pWnd);
}
bool CFFL_RadioButton::OnKeyDown(CPDFSDK_Annot* pAnnot,