summaryrefslogtreecommitdiff
path: root/xfa/fde/cfde_txtedttextset.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2017-01-05 12:57:00 -0800
committerCommit bot <commit-bot@chromium.org>2017-01-05 12:57:00 -0800
commite647799f6a2f7f747c9f55d9f0ce08dcdfbd53f4 (patch)
tree282c502bd9f807f385d0cbcc1692bb475c8a4df1 /xfa/fde/cfde_txtedttextset.cpp
parent6bb3b894488fd6f38c096b708980a9f08286ac5c (diff)
downloadpdfium-e647799f6a2f7f747c9f55d9f0ce08dcdfbd53f4.tar.xz
Properly ref-count CFGAS_GEFont with CFX_RetainPtr.
We worry about cyclical references, but no leaks found. Review-Url: https://codereview.chromium.org/2609423003
Diffstat (limited to 'xfa/fde/cfde_txtedttextset.cpp')
-rw-r--r--xfa/fde/cfde_txtedttextset.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp
index 33da0c5a8f..4149a6df20 100644
--- a/xfa/fde/cfde_txtedttextset.cpp
+++ b/xfa/fde/cfde_txtedttextset.cpp
@@ -8,6 +8,7 @@
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/cfde_txtedtpage.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
CFDE_TxtEdtTextSet::CFDE_TxtEdtTextSet(CFDE_TxtEdtPage* pPage)
: m_pPage(pPage) {}
@@ -25,14 +26,14 @@ void CFDE_TxtEdtTextSet::GetRect(FDE_TEXTEDITPIECE* pPiece, CFX_RectF& rt) {
int32_t CFDE_TxtEdtTextSet::GetString(FDE_TEXTEDITPIECE* pPiece,
CFX_WideString& wsText) {
FX_WCHAR* pBuffer = wsText.GetBuffer(pPiece->nCount);
- for (int32_t i = 0; i < pPiece->nCount; i++) {
+ for (int32_t i = 0; i < pPiece->nCount; i++)
pBuffer[i] = m_pPage->GetChar(pPiece, i);
- }
+
wsText.ReleaseBuffer(pPiece->nCount);
return pPiece->nCount;
}
-CFGAS_GEFont* CFDE_TxtEdtTextSet::GetFont() {
+CFX_RetainPtr<CFGAS_GEFont> CFDE_TxtEdtTextSet::GetFont() {
return m_pPage->GetEngine()->GetEditParams()->pFont;
}