summaryrefslogtreecommitdiff
path: root/xfa/fwl/core
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/fwl/core
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/fwl/core')
-rw-r--r--xfa/fwl/core/fwl_formimp.cpp26
-rw-r--r--xfa/fwl/core/fwl_noteimp.cpp12
-rw-r--r--xfa/fwl/core/fwl_widgetmgrimp.cpp19
3 files changed, 25 insertions, 32 deletions
diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp
index 815aca974c..2fd85a8d0e 100644
--- a/xfa/fwl/core/fwl_formimp.cpp
+++ b/xfa/fwl/core/fwl_formimp.cpp
@@ -471,25 +471,19 @@ void CFWL_FormImp::ShowChildWidget(IFWL_Widget* pParent) {
pChild = pWidgetMgr->GetWidget(pChild, FWL_WGTRELATION_NextSibling);
}
}
+
void CFWL_FormImp::RemoveSysButtons() {
m_rtCaption.Reset();
- if (m_pCloseBox) {
- delete m_pCloseBox;
- m_pCloseBox = NULL;
- }
- if (m_pMinBox) {
- delete m_pMinBox;
- m_pMinBox = NULL;
- }
- if (m_pMaxBox) {
- delete m_pMaxBox;
- m_pMaxBox = NULL;
- }
- if (m_pCaptionBox) {
- delete m_pCaptionBox;
- m_pCaptionBox = NULL;
- }
+ delete m_pCloseBox;
+ m_pCloseBox = nullptr;
+ delete m_pMinBox;
+ m_pMinBox = nullptr;
+ delete m_pMaxBox;
+ m_pMaxBox = nullptr;
+ delete m_pCaptionBox;
+ m_pCaptionBox = nullptr;
}
+
void CFWL_FormImp::CalcContentRect(CFX_RectF& rtContent) {
#ifdef FWL_UseMacSystemBorder
rtContent = m_rtRelative;
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index 267b2ca2ee..39afa783c0 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -870,20 +870,20 @@ CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {
}
delete m_ToolTipDp;
}
+
// static
CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() {
- if (!s_pInstance) {
+ if (!s_pInstance)
s_pInstance = new CFWL_ToolTipContainer;
- }
return s_pInstance;
}
+
// static
void CFWL_ToolTipContainer::DeleteInstance() {
- if (s_pInstance) {
- delete s_pInstance;
- s_pInstance = NULL;
- }
+ delete s_pInstance;
+ s_pInstance = NULL;
}
+
FX_ERR CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) {
if (m_arrWidget.Find(pTarget) < 0) {
m_arrWidget.Add(pTarget);
diff --git a/xfa/fwl/core/fwl_widgetmgrimp.cpp b/xfa/fwl/core/fwl_widgetmgrimp.cpp
index b1e0ca822a..0ce452edb0 100644
--- a/xfa/fwl/core/fwl_widgetmgrimp.cpp
+++ b/xfa/fwl/core/fwl_widgetmgrimp.cpp
@@ -39,6 +39,7 @@ CFWL_WidgetMgr::CFWL_WidgetMgr(IFWL_AdapterNative* pAdapterNative)
m_rtScreen.Reset();
#endif
}
+
CFWL_WidgetMgr::~CFWL_WidgetMgr() {
FX_POSITION ps = m_mapWidgetItem.GetStartPosition();
while (ps) {
@@ -48,11 +49,9 @@ CFWL_WidgetMgr::~CFWL_WidgetMgr() {
delete pItem;
}
m_mapWidgetItem.RemoveAll();
- if (m_pDelegate) {
- delete m_pDelegate;
- m_pDelegate = NULL;
- }
+ delete m_pDelegate;
}
+
int32_t CFWL_WidgetMgr::CountWidgets(IFWL_Widget* pParent) {
CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pParent);
return TravelWidgetMgr(pParentItem, NULL, NULL);
@@ -480,18 +479,18 @@ IFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(IFWL_Widget* parent,
}
return parent;
}
+
void CFWL_WidgetMgr::NotifySizeChanged(IFWL_Widget* pForm,
FX_FLOAT fx,
FX_FLOAT fy) {
- if (!FWL_UseOffscreen(pForm)) {
+ if (!FWL_UseOffscreen(pForm))
return;
- }
+
CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pForm);
- if (pItem->pOffscreen) {
- delete pItem->pOffscreen;
- pItem->pOffscreen = NULL;
- }
+ delete pItem->pOffscreen;
+ pItem->pOffscreen = nullptr;
}
+
IFWL_Widget* CFWL_WidgetMgr::nextTab(IFWL_Widget* parent,
IFWL_Widget* focus,
FX_BOOL& bFind) {