diff options
Diffstat (limited to 'fpdfsdk/formfiller/cffl_formfiller.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 8e9d0c7d65..dace98a8c1 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -28,15 +28,11 @@ CFFL_FormFiller::~CFFL_FormFiller() { void CFFL_FormFiller::DestroyWindows() { while (!m_Maps.empty()) { - std::unique_ptr<CFFL_PrivateData> pData; - { - auto it = m_Maps.begin(); - std::unique_ptr<CPWL_Wnd> pWnd = std::move(it->second); - pData.reset(static_cast<CFFL_PrivateData*>(pWnd->GetAttachedData())); - m_Maps.erase(it); - pWnd->InvalidateProvider(this); - pWnd->Destroy(); - } + auto it = m_Maps.begin(); + std::unique_ptr<CPWL_Wnd> pWnd = std::move(it->second); + m_Maps.erase(it); + pWnd->InvalidateProvider(this); + pWnd->Destroy(); } } @@ -395,8 +391,7 @@ CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, pPrivateData->pPageView = pPageView; pPrivateData->nWidgetAppearanceAge = m_pWidget->GetAppearanceAge(); pPrivateData->nWidgetValueAge = 0; - cp.pAttachedData = pPrivateData.release(); - m_Maps[pPageView] = NewPDFWindow(cp); + m_Maps[pPageView] = NewPDFWindow(cp, std::move(pPrivateData)); return m_Maps[pPageView].get(); } @@ -404,7 +399,8 @@ CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, if (!bNew) return pWnd; - auto* pPrivateData = static_cast<CFFL_PrivateData*>(pWnd->GetAttachedData()); + const auto* pPrivateData = + static_cast<const CFFL_PrivateData*>(pWnd->GetAttachedData()); if (pPrivateData->nWidgetAppearanceAge == m_pWidget->GetAppearanceAge()) return pWnd; @@ -417,18 +413,15 @@ void CFFL_FormFiller::DestroyPDFWindow(CPDFSDK_PageView* pPageView) { if (it == m_Maps.end()) return; - std::unique_ptr<CFFL_PrivateData> pData; - { - std::unique_ptr<CPWL_Wnd> pWnd = std::move(it->second); - m_Maps.erase(it); - pData.reset(static_cast<CFFL_PrivateData*>(pWnd->GetAttachedData())); - pWnd->Destroy(); - } + std::unique_ptr<CPWL_Wnd> pWnd = std::move(it->second); + m_Maps.erase(it); + pWnd->Destroy(); } -CFX_Matrix CFFL_FormFiller::GetWindowMatrix(CPWL_Wnd::PrivateData* pAttached) { +CFX_Matrix CFFL_FormFiller::GetWindowMatrix( + const CPWL_Wnd::PrivateData* pAttached) { CFX_Matrix mt; - auto* pPrivateData = static_cast<CFFL_PrivateData*>(pAttached); + const auto* pPrivateData = static_cast<const CFFL_PrivateData*>(pAttached); if (!pPrivateData || !pPrivateData->pPageView) return mt; |