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

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: 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
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)
Lei Zhang 2016/07/29 22:30:06 multiline body -> braces
Tom Sepez 2016/08/01 16:24:54 Done.
234 pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr,
235 FALSE);
233 } 236 }
234 } else { 237 } else {
235 for (CPDFSDK_Widget* pWidget : widgets) { 238 for (CPDFSDK_Widget* pWidget : widgets) {
236 pWidget->ResetAppearance(nullptr, FALSE); 239 pWidget->ResetAppearance(nullptr, FALSE);
237 } 240 }
238 } 241 }
239 } 242 }
240 243
241 if (bRefresh) { 244 if (bRefresh) {
242 for (CPDFSDK_Widget* pWidget : widgets) { 245 for (CPDFSDK_Widget* pWidget : widgets) {
(...skipping 3288 matching lines...) Expand 10 before | Expand all | Expand 10 after
3531 } 3534 }
3532 } 3535 }
3533 3536
3534 void Field::AddField(CPDFSDK_Document* pDocument, 3537 void Field::AddField(CPDFSDK_Document* pDocument,
3535 int nPageIndex, 3538 int nPageIndex,
3536 int nFieldType, 3539 int nFieldType,
3537 const CFX_WideString& sName, 3540 const CFX_WideString& sName,
3538 const CFX_FloatRect& rcCoords) { 3541 const CFX_FloatRect& rcCoords) {
3539 // Not supported. 3542 // Not supported.
3540 } 3543 }
OLDNEW
« fpdfsdk/include/fsdk_baseform.h ('K') | « fpdfsdk/include/fsdk_baseform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698