From f8074cefb2f8d947fa83d151bcbe080b485d6e6b Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 27 Sep 2016 14:29:57 -0700 Subject: 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 --- fpdfsdk/formfiller/cffl_formfiller.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'fpdfsdk/formfiller/cffl_formfiller.cpp') diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 7aeda57c2e..827b9b09ca 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -527,22 +527,21 @@ FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, FX_BOOL bExit = FALSE; CFFL_InteractiveFormFiller* pFormFiller = m_pEnv->GetInteractiveFormFiller(); - pFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag); - if (bExit) + CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget); + pFormFiller->OnKeyStrokeCommit(&pObserved, pPageView, bRC, bExit, nFlag); + if (!pObserved || bExit) return TRUE; if (!bRC) { ResetPDFWindow(pPageView, FALSE); return TRUE; } - - pFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag); - if (bExit) + pFormFiller->OnValidate(&pObserved, pPageView, bRC, bExit, nFlag); + if (!pObserved || bExit) return TRUE; if (!bRC) { ResetPDFWindow(pPageView, FALSE); return TRUE; } - SaveData(pPageView); pFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); if (bExit) -- cgit v1.2.3