Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Unified Diff: fpdfsdk/javascript/Field.cpp

Issue 2197793002: Watch for destruction of widget during callback (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: asserts, comments, braces Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/include/fsdk_baseform.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/Field.cpp
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index 9b109f7b1bab04a5bcf79df5865d0ea8870c0508..720eb4d9fc5465613c21a216963481bb8e7a27e4 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -228,8 +228,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) {
« no previous file with comments | « fpdfsdk/include/fsdk_baseform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698