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

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: Rebase Created 4 years, 11 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/src/fpdfxfa/fpdfxfa_doc.cpp ('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 <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "fpdfsdk/include/fsdk_mgr.h" 10 #include "fpdfsdk/include/fsdk_mgr.h"
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 if (!pAnnot) 1111 if (!pAnnot)
1112 continue; 1112 continue;
1113 m_fxAnnotArray.push_back(pAnnot); 1113 m_fxAnnotArray.push_back(pAnnot);
1114 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); 1114 pAnnotHandlerMgr->Annot_OnLoad(pAnnot);
1115 } 1115 }
1116 #endif // PDF_ENABLE_XFA 1116 #endif // PDF_ENABLE_XFA
1117 1117
1118 SetLock(FALSE); 1118 SetLock(FALSE);
1119 } 1119 }
1120 1120
1121 void CPDFSDK_PageView::ClearFXAnnots() {
1122 SetLock(TRUE);
1123 if (m_pSDKDoc && GetFocusAnnot())
1124 m_pSDKDoc->SetFocusAnnot(nullptr);
1125 m_CaptureWidget = nullptr;
1126 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray)
1127 m_pSDKDoc->GetEnv()->GetAnnotHandlerMgr()->ReleaseAnnot(pAnnot);
1128 m_fxAnnotArray.clear();
1129 m_pAnnotList.reset();
1130 SetLock(FALSE);
1131 }
1132
1121 void CPDFSDK_PageView::UpdateRects(CFX_RectArray& rects) { 1133 void CPDFSDK_PageView::UpdateRects(CFX_RectArray& rects) {
1122 for (int i = 0; i < rects.GetSize(); i++) { 1134 for (int i = 0; i < rects.GetSize(); i++) {
1123 CPDF_Rect rc = rects.GetAt(i); 1135 CPDF_Rect rc = rects.GetAt(i);
1124 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 1136 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
1125 pEnv->FFI_Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom); 1137 pEnv->FFI_Invalidate(m_page, rc.left, rc.top, rc.right, rc.bottom);
1126 } 1138 }
1127 } 1139 }
1128 1140
1129 void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) { 1141 void CPDFSDK_PageView::UpdateView(CPDFSDK_Annot* pAnnot) {
1130 CPDF_Rect rcWindow = pAnnot->GetRect(); 1142 CPDF_Rect rcWindow = pAnnot->GetRect();
(...skipping 29 matching lines...) Expand all
1160 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); 1172 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot();
1161 if (!pFocusAnnot) 1173 if (!pFocusAnnot)
1162 return nullptr; 1174 return nullptr;
1163 1175
1164 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { 1176 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) {
1165 if (pAnnot == pFocusAnnot) 1177 if (pAnnot == pFocusAnnot)
1166 return pAnnot; 1178 return pAnnot;
1167 } 1179 }
1168 return nullptr; 1180 return nullptr;
1169 } 1181 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698