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

Side by Side 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, 4 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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/include/fsdk_baseform.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/javascript/Field.h" 7 #include "fpdfsdk/javascript/Field.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 FX_BOOL bRefresh) { 221 FX_BOOL bRefresh) {
222 std::vector<CPDFSDK_Widget*> widgets; 222 std::vector<CPDFSDK_Widget*> widgets;
223 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); 223 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
224 pInterForm->GetWidgets(pFormField, &widgets); 224 pInterForm->GetWidgets(pFormField, &widgets);
225 225
226 if (bResetAP) { 226 if (bResetAP) {
227 int nFieldType = pFormField->GetFieldType(); 227 int nFieldType = pFormField->GetFieldType();
228 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) { 228 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) {
229 for (CPDFSDK_Widget* pWidget : widgets) { 229 for (CPDFSDK_Widget* pWidget : widgets) {
230 FX_BOOL bFormatted = FALSE; 230 FX_BOOL bFormatted = FALSE;
231 CPDFSDK_Widget::Observer observer(&pWidget);
231 CFX_WideString sValue = pWidget->OnFormat(bFormatted); 232 CFX_WideString sValue = pWidget->OnFormat(bFormatted);
232 pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr, FALSE); 233 if (pWidget) {
234 pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr,
235 FALSE);
236 }
233 } 237 }
234 } else { 238 } else {
235 for (CPDFSDK_Widget* pWidget : widgets) { 239 for (CPDFSDK_Widget* pWidget : widgets) {
236 pWidget->ResetAppearance(nullptr, FALSE); 240 pWidget->ResetAppearance(nullptr, FALSE);
237 } 241 }
238 } 242 }
239 } 243 }
240 244
241 if (bRefresh) { 245 if (bRefresh) {
242 for (CPDFSDK_Widget* pWidget : widgets) { 246 for (CPDFSDK_Widget* pWidget : widgets) {
(...skipping 3288 matching lines...) Expand 10 before | Expand all | Expand 10 after
3531 } 3535 }
3532 } 3536 }
3533 3537
3534 void Field::AddField(CPDFSDK_Document* pDocument, 3538 void Field::AddField(CPDFSDK_Document* pDocument,
3535 int nPageIndex, 3539 int nPageIndex,
3536 int nFieldType, 3540 int nFieldType,
3537 const CFX_WideString& sName, 3541 const CFX_WideString& sName,
3538 const CFX_FloatRect& rcCoords) { 3542 const CFX_FloatRect& rcCoords) {
3539 // Not supported. 3543 // Not supported.
3540 } 3544 }
OLDNEW
« 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