diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-21 23:10:51 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-21 23:10:51 +0000 |
commit | ae386367e8c0475fd5bcbacb9baa557409afb9c6 (patch) | |
tree | 0363fab846c6bbcbfb0c3f66d1988b4906f07b3e /fpdfsdk/pwl/cpwl_appstream.cpp | |
parent | bcdbeaea96d53800ee806f463108f54f79a19347 (diff) | |
download | pdfium-ae386367e8c0475fd5bcbacb9baa557409afb9c6.tar.xz |
Use UnownedPtr in CPDF_VariableText
Re-arrange order of some variables so that the lifetime
constraints are not violated, even temporarilly.
Change-Id: I859f1217d5af0f4c703a3d8ed742c1f144cc1c61
Reviewed-on: https://pdfium-review.googlesource.com/40950
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/pwl/cpwl_appstream.cpp')
-rw-r--r-- | fpdfsdk/pwl/cpwl_appstream.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/pwl/cpwl_appstream.cpp index c17c146d20..512af1437a 100644 --- a/fpdfsdk/pwl/cpwl_appstream.cpp +++ b/fpdfsdk/pwl/cpwl_appstream.cpp @@ -1597,12 +1597,13 @@ void CPWL_AppStream::SetAsComboBox(const WideString* sValue) { rcButton.left = rcButton.right - 13; rcButton.Normalize(); - auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>(); - pEdit->EnableRefresh(false); - + // Font map must outlive |pEdit|. CBA_FontMap font_map( widget_.Get(), widget_->GetInterForm()->GetFormFillEnv()->GetSysHandler()); + + auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>(); + pEdit->EnableRefresh(false); pEdit->SetFontMap(&font_map); CFX_FloatRect rcEdit = rcClient; @@ -1663,12 +1664,13 @@ void CPWL_AppStream::SetAsListBox() { CFX_FloatRect rcClient = widget_->GetClientRect(); std::ostringstream sBody; - auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>(); - pEdit->EnableRefresh(false); - + // Font map must outlive |pEdit|. CBA_FontMap font_map( widget_.Get(), widget_->GetInterForm()->GetFormFillEnv()->GetSysHandler()); + + auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>(); + pEdit->EnableRefresh(false); pEdit->SetFontMap(&font_map); pEdit->SetPlateRect(CFX_FloatRect(rcClient.left, 0.0f, rcClient.right, 0.0f)); @@ -1747,12 +1749,13 @@ void CPWL_AppStream::SetAsTextField(const WideString* sValue) { std::ostringstream sBody; std::ostringstream sLines; - auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>(); - pEdit->EnableRefresh(false); - + // Font map must outlive |pEdit|. CBA_FontMap font_map( widget_.Get(), widget_->GetInterForm()->GetFormFillEnv()->GetSysHandler()); + + auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>(); + pEdit->EnableRefresh(false); pEdit->SetFontMap(&font_map); CFX_FloatRect rcClient = widget_->GetClientRect(); |