summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-08-01 10:10:36 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-01 10:10:36 -0700
commitca97a8ee99cad1ddb6a69e14cc7a501b3e8092a4 (patch)
treeedae775ef47a5eb65244158c9142974592db4c15 /fpdfsdk/javascript
parentab47acec5252d4a09da3cbde1a118b5255fe52ae (diff)
downloadpdfium-ca97a8ee99cad1ddb6a69e14cc7a501b3e8092a4.tar.xz
Watch for destruction of CPDFSDK_widget during callback
Speculative fix since I had trouble with the repro. BUG=632709 Review-Url: https://codereview.chromium.org/2197793002
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r--fpdfsdk/javascript/Field.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index 38309cfac5..937b3c6e61 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -229,8 +229,12 @@ void Field::UpdateFormField(CPDFSDK_Document* pDocument,
if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) {
for (CPDFSDK_Widget* pWidget : widgets) {
FX_BOOL bFormatted = FALSE;
+ CPDFSDK_Widget::Observer observer(&pWidget);
CFX_WideString sValue = pWidget->OnFormat(bFormatted);
- pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr, FALSE);
+ if (pWidget) {
+ pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr,
+ FALSE);
+ }
}
} else {
for (CPDFSDK_Widget* pWidget : widgets) {