summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-10-05 14:11:31 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-05 18:31:36 +0000
commit1a45ce380ec6776ac100017c68a4b8643983d2db (patch)
tree6d20b6b6ce639abaa1842fd4ef5f468e1889e802 /fpdfsdk
parentb5787481f77fc0a002a10c8047aad591a805f723 (diff)
downloadpdfium-1a45ce380ec6776ac100017c68a4b8643983d2db.tar.xz
Add ObservedPtrs to catch issues in SaveData
BUG=chromium:756427 Change-Id: I90c7065ec5a467cb954cdf3e1d6954a0b0655d4e Reviewed-on: https://pdfium-review.googlesource.com/15630 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.cpp7
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.cpp11
2 files changed, 12 insertions, 6 deletions
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index 70d3990ea3..fb1afe94b4 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -672,9 +672,10 @@ void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Annot::ObservedPtr* pAnnot,
return;
CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get());
- ASSERT(pWidget);
- CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm();
- pInterForm->OnCalculate(pWidget->GetFormField());
+ if (pWidget) {
+ CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm();
+ pInterForm->OnCalculate(pWidget->GetFormField());
+ }
m_bNotifying = false;
}
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 76434a5216..4174ae4179 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -139,10 +139,15 @@ void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) {
WideString sOldValue = m_pWidget->GetValue();
WideString sNewValue = pWnd->GetText();
+ CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get());
+ CFFL_TextField::ObservedPtr observed_this(this);
m_pWidget->SetValue(sNewValue, false);
- m_pWidget->ResetFieldAppearance(true);
- m_pWidget->UpdateField();
- SetChangeMark();
+ if (observed_widget)
+ m_pWidget->ResetFieldAppearance(true);
+ if (observed_widget)
+ m_pWidget->UpdateField();
+ if (observed_this)
+ SetChangeMark();
}
void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView,