diff options
author | tsepez <tsepez@chromium.org> | 2016-08-01 10:10:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-01 10:10:36 -0700 |
commit | ca97a8ee99cad1ddb6a69e14cc7a501b3e8092a4 (patch) | |
tree | edae775ef47a5eb65244158c9142974592db4c15 /fpdfsdk/javascript | |
parent | ab47acec5252d4a09da3cbde1a118b5255fe52ae (diff) | |
download | pdfium-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.cpp | 6 |
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) { |