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

Side by Side Diff: xfa/fgas/font/fgas_stdfontmgr.cpp

Issue 2297303004: Fix leaked internal font (Closed)
Patch Set: Created 4 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 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 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 "xfa/fgas/font/fgas_stdfontmgr.h" 7 #include "xfa/fgas/font/fgas_stdfontmgr.h"
8 8
9 #include "core/fxcrt/include/fx_stream.h" 9 #include "core/fxcrt/include/fx_stream.h"
10 #include "core/fxge/include/cfx_fontmapper.h" 10 #include "core/fxge/include/cfx_fontmapper.h"
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 pFontStream->Release(); 849 pFontStream->Release();
850 return nullptr; 850 return nullptr;
851 } 851 }
852 852
853 CFX_Font* pInternalFont = new CFX_Font(); 853 CFX_Font* pInternalFont = new CFX_Font();
854 if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) { 854 if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) {
855 pFontStream->Release(); 855 pFontStream->Release();
856 return nullptr; 856 return nullptr;
857 } 857 }
858 858
859 CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(pInternalFont, this); 859 CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(pInternalFont, false, this);
860 if (!pFont) { 860 if (!pFont) {
861 pFontStream->Release(); 861 pFontStream->Release();
862 return nullptr; 862 return nullptr;
863 } 863 }
864 864
865 m_IFXFont2FileRead.SetAt(pFont, pFontStream); 865 m_IFXFont2FileRead.SetAt(pFont, pFontStream);
866 if (pFaceCount) 866 if (pFaceCount)
867 *pFaceCount = pFont->GetDevFont()->GetFace()->num_faces; 867 *pFaceCount = pFont->GetDevFont()->GetFace()->num_faces;
868 868
869 return pFont; 869 return pFont;
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 1385
1386 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1, 1386 int32_t CFGAS_FontMgrImp::IsPartName(const CFX_WideString& Name1,
1387 const CFX_WideString& Name2) { 1387 const CFX_WideString& Name2) {
1388 if (Name1.Find(Name2.c_str()) != -1) { 1388 if (Name1.Find(Name2.c_str()) != -1) {
1389 return 1; 1389 return 1;
1390 } 1390 }
1391 return 0; 1391 return 0;
1392 } 1392 }
1393 1393
1394 #endif 1394 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698