diff options
author | tsepez <tsepez@chromium.org> | 2016-09-27 14:29:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-27 14:29:57 -0700 |
commit | f8074cefb2f8d947fa83d151bcbe080b485d6e6b (patch) | |
tree | fe97655234318181a58827666576010abb745b18 /fpdfsdk/formfiller/cffl_checkbox.cpp | |
parent | ec7a9455c15b2cebb75a6036c8636beb601e543a (diff) | |
download | pdfium-f8074cefb2f8d947fa83d151bcbe080b485d6e6b.tar.xz |
Watch destruction of widgets around OnAAction() method.
We implemented the CFX_Observable mechanism for detecting
stale objects some time ago; now just use it in more places.
Change method signatures to required an ObservedPtr to
indicate that the callers are aware that the value may be
destroyed out from underneath them.
BUG=649659
Review-Url: https://codereview.chromium.org/2368403002
Diffstat (limited to 'fpdfsdk/formfiller/cffl_checkbox.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cffl_checkbox.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp index 01f1a2a08c..334adb68ed 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.cpp +++ b/fpdfsdk/formfiller/cffl_checkbox.cpp @@ -47,15 +47,17 @@ FX_BOOL CFFL_CheckBox::OnChar(CPDFSDK_Annot* pAnnot, FX_BOOL bReset = FALSE; FX_BOOL bExit = FALSE; - m_pEnv->GetInteractiveFormFiller()->OnButtonUp(m_pWidget, pPageView, + CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); + m_pEnv->GetInteractiveFormFiller()->OnButtonUp(&pObserved, pPageView, bReset, bExit, nFlags); - if (bReset) + if (!pObserved) { + m_pWidget = nullptr; return TRUE; - if (bExit) + } + if (bReset || bExit) return TRUE; CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); - if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, TRUE)) pWnd->SetCheck(!pWnd->IsChecked()); |