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

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

Issue 594403003: Lock page in LoadFXAnnot to prevent unintended page closing (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 3 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 "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fsdk_mgr.h"
8 #include "../include/fpdfview.h" 9 #include "../include/fpdfview.h"
9 #include "../include/fsdk_rendercontext.h" 10 #include "../include/fsdk_rendercontext.h"
10 #include "../include/fpdf_progressive.h" 11 #include "../include/fpdf_progressive.h"
11 #include "../include/fpdf_ext.h" 12 #include "../include/fpdf_ext.h"
12 #include "../../third_party/numerics/safe_conversions_impl.h" 13 #include "../../third_party/numerics/safe_conversions_impl.h"
13 14
14 CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess) 15 CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess)
15 { 16 {
16 if (pFileAccess) 17 if (pFileAccess)
17 m_FileAccess = *pFileAccess; 18 m_FileAccess = *pFileAccess;
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 585
585 Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate , flags,TRUE,NULL); 586 Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate , flags,TRUE,NULL);
586 587
587 delete pContext; 588 delete pContext;
588 pPage->RemovePrivateData((void*)1); 589 pPage->RemovePrivateData((void*)1);
589 } 590 }
590 591
591 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page) 592 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page)
592 { 593 {
593 if (!page) return; 594 if (!page) return;
595 CPDFSDK_PageView* pPageView = (CPDFSDK_PageView*)(((CPDF_Page*)page))->G etPrivateData((FX_LPVOID)page);
596 if (pPageView && pPageView->IsLocked()) {
597 pPageView->TakeOverPage();
598 return;
599 }
594 delete (CPDF_Page*)page; 600 delete (CPDF_Page*)page;
595 601
596 } 602 }
597 603
598 DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document) 604 DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document)
599 { 605 {
600 if (!document) 606 if (!document)
601 return; 607 return;
602 CPDF_Document* pDoc = (CPDF_Document*)document; 608 CPDF_Document* pDoc = (CPDF_Document*)document;
603 CPDF_Parser* pParser = (CPDF_Parser*)pDoc->GetParser(); 609 CPDF_Parser* pParser = (CPDF_Parser*)pDoc->GetParser();
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 { 855 {
850 if (document == NULL) 856 if (document == NULL)
851 return NULL; 857 return NULL;
852 if (name == NULL || name[0] == 0) 858 if (name == NULL || name[0] == 0)
853 return NULL; 859 return NULL;
854 860
855 CPDF_Document* pDoc = (CPDF_Document*)document; 861 CPDF_Document* pDoc = (CPDF_Document*)document;
856 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests")); 862 CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
857 return name_tree.LookupNamedDest(pDoc, name); 863 return name_tree.LookupNamedDest(pDoc, name);
858 } 864 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698