| OLD | NEW |
| 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 "public/fpdfview.h" | 7 #include "public/fpdfview.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page) { | 663 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page) { |
| 664 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 664 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 665 if (!page) | 665 if (!page) |
| 666 return; | 666 return; |
| 667 #ifdef PDF_ENABLE_XFA | 667 #ifdef PDF_ENABLE_XFA |
| 668 pPage->Release(); | 668 pPage->Release(); |
| 669 #else // PDF_ENABLE_XFA | 669 #else // PDF_ENABLE_XFA |
| 670 CPDFSDK_PageView* pPageView = | 670 CPDFSDK_PageView* pPageView = |
| 671 static_cast<CPDFSDK_PageView*>(pPage->GetView()); | 671 static_cast<CPDFSDK_PageView*>(pPage->GetView()); |
| 672 if (pPageView) { | 672 if (pPageView) { |
| 673 // We're already destroying the pageview, so bail early. |
| 674 if (pPageView->IsBeingDestroyed()) |
| 675 return; |
| 676 |
| 673 if (pPageView->IsLocked()) { | 677 if (pPageView->IsLocked()) { |
| 674 pPageView->TakePageOwnership(); | 678 pPageView->TakePageOwnership(); |
| 675 return; | 679 return; |
| 676 } | 680 } |
| 677 | 681 |
| 678 bool owned = pPageView->OwnsPage(); | 682 bool owned = pPageView->OwnsPage(); |
| 679 // This will delete the |pPageView| object. We must cleanup the PageView | 683 // This will delete the |pPageView| object. We must cleanup the PageView |
| 680 // first because it will attempt to reset the View on the |pPage| during | 684 // first because it will attempt to reset the View on the |pPage| during |
| 681 // destruction. | 685 // destruction. |
| 682 pPageView->GetSDKDocument()->RemovePageView(pPage); | 686 pPageView->GetSDKDocument()->RemovePageView(pPage); |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 if (!buffer) { | 1128 if (!buffer) { |
| 1125 *buflen = len; | 1129 *buflen = len; |
| 1126 } else if (*buflen >= len) { | 1130 } else if (*buflen >= len) { |
| 1127 memcpy(buffer, utf16Name.c_str(), len); | 1131 memcpy(buffer, utf16Name.c_str(), len); |
| 1128 *buflen = len; | 1132 *buflen = len; |
| 1129 } else { | 1133 } else { |
| 1130 *buflen = -1; | 1134 *buflen = -1; |
| 1131 } | 1135 } |
| 1132 return (FPDF_DEST)pDestObj; | 1136 return (FPDF_DEST)pDestObj; |
| 1133 } | 1137 } |
| OLD | NEW |