summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
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/fxfa/app
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/fxfa/app')
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp7
-rw-r--r--xfa/fxfa/app/xfa_ffpushbutton.cpp26
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp13
-rw-r--r--xfa/fxfa/app/xfa_textlayout.cpp18
4 files changed, 26 insertions, 38 deletions
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index d58b594e27..cd48a43a0e 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -62,13 +62,12 @@ CXFA_FFDocView::CXFA_FFDocView(CXFA_FFDoc* pDoc)
m_pOldFocusWidget(nullptr),
m_iStatus(XFA_DOCVIEW_LAYOUTSTATUS_None),
m_iLock(0) {}
+
CXFA_FFDocView::~CXFA_FFDocView() {
DestroyDocView();
- if (m_pWidgetHandler) {
- delete m_pWidgetHandler;
- }
- m_pWidgetHandler = NULL;
+ delete m_pWidgetHandler;
}
+
void CXFA_FFDocView::InitLayout(CXFA_Node* pNode) {
RunBindItems();
ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Initialize);
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp
index 3893bc29fb..6db2b7078c 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -86,25 +86,19 @@ void CXFA_FFPushButton::UpdateWidgetProperty() {
}
m_pNormalWidget->ModifyStylesEx(dwStyleEx, 0xFFFFFFFF);
}
+
void CXFA_FFPushButton::UnloadWidget() {
- if (m_pRolloverTextLayout) {
- delete m_pRolloverTextLayout;
- m_pRolloverTextLayout = NULL;
- }
- if (m_pDownTextLayout) {
- delete m_pDownTextLayout;
- m_pDownTextLayout = NULL;
- }
- if (m_pDownProvider) {
- delete m_pDownProvider;
- m_pDownProvider = NULL;
- }
- if (m_pRollProvider) {
- delete m_pRollProvider;
- m_pRollProvider = NULL;
- }
+ delete m_pRolloverTextLayout;
+ m_pRolloverTextLayout = nullptr;
+ delete m_pDownTextLayout;
+ m_pDownTextLayout = nullptr;
+ delete m_pDownProvider;
+ m_pDownProvider = nullptr;
+ delete m_pRollProvider;
+ m_pRollProvider = nullptr;
CXFA_FFField::UnloadWidget();
}
+
FX_BOOL CXFA_FFPushButton::PerformLayout() {
CXFA_FFWidget::PerformLayout();
CFX_RectF rtWidget;
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index 34b29c79d2..c1af34c030 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -526,17 +526,14 @@ CXFA_ImageRenderer::CXFA_ImageRenderer() {
m_Result = TRUE;
m_bPrint = FALSE;
}
+
CXFA_ImageRenderer::~CXFA_ImageRenderer() {
- if (m_pCloneConvert) {
- delete m_pCloneConvert;
- }
- if (m_pTransformer) {
- delete m_pTransformer;
- }
- if (m_DeviceHandle) {
+ delete m_pCloneConvert;
+ delete m_pTransformer;
+ if (m_DeviceHandle)
m_pDevice->CancelDIBits(m_DeviceHandle);
- }
}
+
FX_BOOL CXFA_ImageRenderer::Start(CFX_RenderDevice* pDevice,
CFX_DIBSource* pDIBSource,
FX_ARGB bitmap_argb,
diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp
index f2479b7d2f..9ed84e1604 100644
--- a/xfa/fxfa/app/xfa_textlayout.cpp
+++ b/xfa/fxfa/app/xfa_textlayout.cpp
@@ -996,6 +996,7 @@ int32_t CXFA_TextLayout::CountBlocks() const {
int32_t iCount = m_Blocks.GetSize() / 2;
return iCount > 0 ? iCount : 1;
}
+
FX_BOOL CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize,
const CFX_SizeF& maxSize,
CFX_SizeF& defaultSize) {
@@ -1014,13 +1015,12 @@ FX_BOOL CXFA_TextLayout::CalcSize(const CFX_SizeF& minSize,
if (fLinePos < 0.1f) {
fLinePos = m_textParser.GetFontSize(m_pTextProvider, NULL);
}
- if (m_pTabstopContext) {
- delete m_pTabstopContext;
- m_pTabstopContext = NULL;
- }
+ delete m_pTabstopContext;
+ m_pTabstopContext = nullptr;
defaultSize = CFX_SizeF(m_fMaxWidth, fLinePos);
return TRUE;
}
+
FX_BOOL CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) {
if (size.x < 1) {
return FALSE;
@@ -1035,15 +1035,13 @@ FX_BOOL CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) {
FX_FLOAT fLinePos = 0;
Loader(size, fLinePos, TRUE);
UpdateAlign(size.y, fLinePos);
- if (m_pTabstopContext) {
- delete m_pTabstopContext;
- m_pTabstopContext = NULL;
- }
- if (fHeight) {
+ delete m_pTabstopContext;
+ m_pTabstopContext = nullptr;
+ if (fHeight)
*fHeight = fLinePos;
- }
return TRUE;
}
+
FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) {
if (m_pLoader == NULL || iBlock < 0 || iBlock >= CountBlocks()) {
return FALSE;