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

Side by Side Diff: fpdfsdk/src/fsdk_mgr.cpp

Issue 1539193003: Fix crashing in CPDFXFA_Document::GetPage() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "fpdfsdk/include/fsdk_mgr.h" 9 #include "fpdfsdk/include/fsdk_mgr.h"
10 10
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 if (!pAnnot) 1112 if (!pAnnot)
1113 continue; 1113 continue;
1114 m_fxAnnotArray.push_back(pAnnot); 1114 m_fxAnnotArray.push_back(pAnnot);
1115 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); 1115 pAnnotHandlerMgr->Annot_OnLoad(pAnnot);
1116 } 1116 }
1117 #endif // PDF_ENABLE_XFA 1117 #endif // PDF_ENABLE_XFA
1118 1118
1119 SetLock(FALSE); 1119 SetLock(FALSE);
1120 } 1120 }
1121 1121
1122 void CPDFSDK_PageView::ClearFXAnnots() {
1123 SetLock(TRUE);
1124 if (m_pSDKDoc && GetFocusAnnot())
Lei Zhang 2015/12/21 17:47:59 Why bother calling GetFocusAnnot() ?
1125 m_pSDKDoc->SetFocusAnnot(nullptr);
1126 m_CaptureWidget = nullptr;
1127 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray)
1128 m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr()->ReleaseAnnot(pAnnot);
1129 m_fxAnnotArray.clear();
1130 m_pAnnotList.reset();
1131 SetLock(FALSE);
1132 }
1133
1122 void CPDFSDK_PageView::UpdateRects(CFX_RectArray& rects) { 1134 void CPDFSDK_PageView::UpdateRects(CFX_RectArray& rects) {
1123 for (int i = 0; i < rects.GetSize(); i++) { 1135 for (int i = 0; i < rects.GetSize(); i++) {
1124 CPDF_Rect rc = rects.GetAt(i); 1136 CPDF_Rect rc = rects.GetAt(i);
1125 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 1137 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
1126 pEnv->FFI_Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom); 1138 pEnv->FFI_Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom);
1127 } 1139 }
1128 } 1140 }
1129 1141
1130 void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) { 1142 void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) {
1131 CPDF_Rect rcWindow = pAnnot->GetRect(); 1143 CPDF_Rect rcWindow = pAnnot->GetRect();
(...skipping 29 matching lines...) Expand all
1161 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); 1173 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot();
1162 if (!pFocusAnnot) 1174 if (!pFocusAnnot)
1163 return nullptr; 1175 return nullptr;
1164 1176
1165 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { 1177 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) {
1166 if (pAnnot == pFocusAnnot) 1178 if (pAnnot == pFocusAnnot)
1167 return pAnnot; 1179 return pAnnot;
1168 } 1180 }
1169 return nullptr; 1181 return nullptr;
1170 } 1182 }
OLDNEW
« fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp ('K') | « fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698