Index: xfa/fde/cfde_txtedtbuf.cpp |
diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp |
index 7af5a1892be36413d2bd38638e4432c0b3ba55d3..fcb3cd3270fe254085ab8e808cf88c660de59544 100644 |
--- a/xfa/fde/cfde_txtedtbuf.cpp |
+++ b/xfa/fde/cfde_txtedtbuf.cpp |
@@ -16,17 +16,12 @@ const int kDefaultChunkCount = 2; |
} // namespace |
CFDE_TxtEdtBuf::CFDE_TxtEdtBuf() |
- : m_nChunkSize(kDefaultChunkSize), |
- m_nTotal(0), |
- m_bChanged(FALSE), |
- m_pAllocator(nullptr) { |
- ASSERT(m_nChunkSize); |
+ : m_nChunkSize(kDefaultChunkSize), m_nTotal(0), m_bChanged(FALSE) { |
ResetChunkBuffer(kDefaultChunkCount, m_nChunkSize); |
} |
CFDE_TxtEdtBuf::~CFDE_TxtEdtBuf() { |
Clear(TRUE); |
- delete m_pAllocator; |
m_Chunks.RemoveAll(); |
} |
@@ -271,14 +266,12 @@ void CFDE_TxtEdtBuf::ResetChunkBuffer(int32_t nDefChunkCount, |
int32_t nChunkSize) { |
ASSERT(nChunkSize); |
ASSERT(nDefChunkCount); |
- delete m_pAllocator; |
- m_pAllocator = nullptr; |
m_Chunks.RemoveAll(); |
m_nChunkSize = nChunkSize; |
int32_t nChunkLength = |
sizeof(FDE_CHUNKHEADER) + (m_nChunkSize - 1) * sizeof(FX_WCHAR); |
- m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Fixed, nDefChunkCount, |
- nChunkLength); |
+ m_pAllocator.reset(IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Fixed, |
Lei Zhang
2016/08/04 18:09:15
Can we change IFX_MemoryAllocator::Create() to ret
Wei Li
2016/08/04 21:42:25
Done.
|
+ nDefChunkCount, nChunkLength)); |
FDE_CHUNKHEADER* lpChunkHeader = |
static_cast<FDE_CHUNKHEADER*>(m_pAllocator->Alloc(nChunkLength)); |
ASSERT(lpChunkHeader); |