diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-06-18 12:47:11 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-06-18 12:47:11 -0700 |
commit | 2c28619de8051661c7f66f2192c6fb9ef14ee905 (patch) | |
tree | 4bd15bf0bb72e4127403548bf2f40230bbdd352b /core/src/fpdfapi | |
parent | 0c1bd7c6ad378ea97a2f54cb0c4761716f6d1057 (diff) | |
download | pdfium-2c28619de8051661c7f66f2192c6fb9ef14ee905.tar.xz |
Replace some Release() calls with virtual destructors.
Required fixing xfa-specific code.
Original Review URL: https://codereview.chromium.org/1192013002.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1176413004.
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r-- | core/src/fpdfapi/fpdf_font/ttgsubtable.cpp | 10 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/ttgsubtable.h | 8 |
2 files changed, 7 insertions, 11 deletions
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp index 3dde7fbdf6..a65359c1d4 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -4,9 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "../../../../third_party/base/nonstd_unique_ptr.h" #include "../../../include/fxge/fx_ge.h" #include "../../../include/fxge/fx_freetype.h" #include "ttgsubtable.h" + CFX_GlyphMap::CFX_GlyphMap() { } @@ -422,7 +424,8 @@ FX_BOOL CFX_GSUBTable::GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) { return m_GsubImp.GetVerticalGlyph(glyphnum, vglyphnum); } -IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont) +// static +IFX_GSUBTable* IFX_GSUBTable::Create(CFX_Font* pFont) { if (!pFont) { return NULL; @@ -439,11 +442,10 @@ IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont) } int error = FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, pFont->m_pGsubData, NULL); if (!error && pFont->m_pGsubData) { - CFX_GSUBTable* pGsubTable = new CFX_GSUBTable; + nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->m_pGsubData)) { - return pGsubTable; + return pGsubTable.release(); } - pGsubTable->Release(); } return NULL; } diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h index 31eff141b4..69ccc3e453 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h @@ -411,16 +411,10 @@ private: class CFX_GSUBTable final : public IFX_GSUBTable { public: - virtual void Release() override - { - delete this; - } + ~CFX_GSUBTable() override {} virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) override; CFX_CTTGSUBTable m_GsubImp; - -private: - ~CFX_GSUBTable() { } }; #endif // CORE_SRC_FPDFAPI_FPDF_FONT_TTGSUBTABLE_H_ |