summaryrefslogtreecommitdiff
path: root/xfa/fee/fde_txtedtpage.cpp
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-04-28 17:29:19 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-28 17:29:19 -0700
commit495bda110a6ea8e7a6fc313ec0232a9ca6e3cfdc (patch)
tree42abda300274f81009bdb9866e0f7e3f81164726 /xfa/fee/fde_txtedtpage.cpp
parenta31098417852bdf13e693a6e0913e0706cf94098 (diff)
downloadpdfium-495bda110a6ea8e7a6fc313ec0232a9ca6e3cfdc.tar.xz
Do not check pointers before deleting them.
XFA edition. Review-Url: https://codereview.chromium.org/1925363002
Diffstat (limited to 'xfa/fee/fde_txtedtpage.cpp')
-rw-r--r--xfa/fee/fde_txtedtpage.cpp56
1 files changed, 23 insertions, 33 deletions
diff --git a/xfa/fee/fde_txtedtpage.cpp b/xfa/fee/fde_txtedtpage.cpp
index 5faafebd55..c50f66e2ff 100644
--- a/xfa/fee/fde_txtedtpage.cpp
+++ b/xfa/fee/fde_txtedtpage.cpp
@@ -139,21 +139,15 @@ CFDE_TxtEdtPage::CFDE_TxtEdtPage(IFDE_TxtEdtEngine* pEngine, int32_t nPageIndex)
FXSYS_memset(&m_rtPageCanvas, 0, sizeof(CFX_RectF));
m_pEditEngine = (CFDE_TxtEdtEngine*)pEngine;
}
+
CFDE_TxtEdtPage::~CFDE_TxtEdtPage() {
m_PieceMassArr.RemoveAll(TRUE);
- if (m_pTextSet) {
- delete m_pTextSet;
- m_pTextSet = NULL;
- }
- if (m_pCharWidth) {
- delete[] m_pCharWidth;
- m_pCharWidth = NULL;
- }
- if (m_pIter != NULL) {
+ delete m_pTextSet;
+ delete[] m_pCharWidth;
+ if (m_pIter)
m_pIter->Release();
- m_pIter = NULL;
- }
}
+
void CFDE_TxtEdtPage::Release() {
delete this;
}
@@ -555,32 +549,28 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox,
m_bLoaded = TRUE;
return 0;
}
+
void CFDE_TxtEdtPage::UnloadPage(const CFX_RectF* pClipBox) {
ASSERT(m_nRefCount > 0);
m_nRefCount--;
- if (m_nRefCount == 0) {
- m_PieceMassArr.RemoveAll();
- if (m_pTextSet) {
- delete m_pTextSet;
- m_pTextSet = NULL;
- }
- if (m_pCharWidth) {
- delete[] m_pCharWidth;
- m_pCharWidth = NULL;
- }
- if (m_pBgnParag) {
- m_pBgnParag->UnloadParag();
- }
- if (m_pEndParag) {
- m_pEndParag->UnloadParag();
- }
- if (m_pIter) {
- m_pIter->Release();
- m_pIter = NULL;
- }
- m_pBgnParag = NULL;
- m_pEndParag = NULL;
+ if (m_nRefCount != 0)
+ return;
+
+ m_PieceMassArr.RemoveAll();
+ delete m_pTextSet;
+ m_pTextSet = nullptr;
+ delete[] m_pCharWidth;
+ m_pCharWidth = nullptr;
+ if (m_pBgnParag)
+ m_pBgnParag->UnloadParag();
+ if (m_pEndParag)
+ m_pEndParag->UnloadParag();
+ if (m_pIter) {
+ m_pIter->Release();
+ m_pIter = nullptr;
}
+ m_pBgnParag = nullptr;
+ m_pEndParag = nullptr;
}
const CFX_RectF& CFDE_TxtEdtPage::GetContentsBox() {