summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-06-13 14:09:46 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-06-15 18:42:52 +0000
commitcd8ff7e9eb651a2ab78bd17a7d8a6cc6d9cce9c4 (patch)
tree383ca0ed8806d3db007adf3fd61e4667db412b8c
parent6a3fc45b9e238d9b7b601cb13be664391d393b42 (diff)
downloadpdfium-cd8ff7e9eb651a2ab78bd17a7d8a6cc6d9cce9c4.tar.xz
Check for destroyed annotations in CPDFSDK_WidgetHandler::OnLoad().
BUG=chromium:732039 Change-Id: I0bc6b24cb41f093eae7bd0a96bcdd441ec8322d7 Reviewed-on: https://pdfium-review.googlesource.com/6531 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--fpdfsdk/cpdfsdk_widgethandler.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index 1e63f5ecc6..c34f766793 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -229,7 +229,11 @@ void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
int nFieldType = pWidget->GetFieldType();
if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
bool bFormatted = false;
+ CPDFSDK_Annot::ObservedPtr pObserved(pWidget);
CFX_WideString sValue = pWidget->OnFormat(bFormatted);
+ if (!pObserved)
+ return;
+
if (bFormatted && nFieldType == FIELDTYPE_COMBOBOX)
pWidget->ResetAppearance(&sValue, false);
}