Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: xfa/fxfa/app/xfa_ffpushbutton.cpp

Issue 1925363002: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/app/xfa_ffpushbutton.h" 7 #include "xfa/fxfa/app/xfa_ffpushbutton.h"
8 8
9 #include "xfa/fwl/core/fwl_noteimp.h" 9 #include "xfa/fwl/core/fwl_noteimp.h"
10 #include "xfa/fwl/core/fwl_widgetmgrimp.h" 10 #include "xfa/fwl/core/fwl_widgetmgrimp.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 dwStyleEx = XFA_FWL_PSBSTYLEEXT_HiliteOutLine; 79 dwStyleEx = XFA_FWL_PSBSTYLEEXT_HiliteOutLine;
80 break; 80 break;
81 case XFA_ATTRIBUTEENUM_Push: 81 case XFA_ATTRIBUTEENUM_Push:
82 dwStyleEx = XFA_FWL_PSBSTYLEEXT_HilitePush; 82 dwStyleEx = XFA_FWL_PSBSTYLEEXT_HilitePush;
83 break; 83 break;
84 default: 84 default:
85 break; 85 break;
86 } 86 }
87 m_pNormalWidget->ModifyStylesEx(dwStyleEx, 0xFFFFFFFF); 87 m_pNormalWidget->ModifyStylesEx(dwStyleEx, 0xFFFFFFFF);
88 } 88 }
89
89 void CXFA_FFPushButton::UnloadWidget() { 90 void CXFA_FFPushButton::UnloadWidget() {
90 if (m_pRolloverTextLayout) { 91 delete m_pRolloverTextLayout;
91 delete m_pRolloverTextLayout; 92 m_pRolloverTextLayout = NULL;
Tom Sepez 2016/04/28 21:47:22 nullptr.
Lei Zhang 2016/04/28 22:31:10 Done.
92 m_pRolloverTextLayout = NULL; 93 delete m_pDownTextLayout;
93 } 94 m_pDownTextLayout = nullptr;
94 if (m_pDownTextLayout) { 95 delete m_pDownProvider;
95 delete m_pDownTextLayout; 96 m_pDownProvider = nullptr;
96 m_pDownTextLayout = NULL; 97 delete m_pRollProvider;
97 } 98 m_pRollProvider = nullptr;
98 if (m_pDownProvider) {
99 delete m_pDownProvider;
100 m_pDownProvider = NULL;
101 }
102 if (m_pRollProvider) {
103 delete m_pRollProvider;
104 m_pRollProvider = NULL;
105 }
106 CXFA_FFField::UnloadWidget(); 99 CXFA_FFField::UnloadWidget();
107 } 100 }
101
108 FX_BOOL CXFA_FFPushButton::PerformLayout() { 102 FX_BOOL CXFA_FFPushButton::PerformLayout() {
109 CXFA_FFWidget::PerformLayout(); 103 CXFA_FFWidget::PerformLayout();
110 CFX_RectF rtWidget; 104 CFX_RectF rtWidget;
111 GetRectWithoutRotate(rtWidget); 105 GetRectWithoutRotate(rtWidget);
112 m_rtUI = rtWidget; 106 m_rtUI = rtWidget;
113 if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) { 107 if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
114 XFA_RectWidthoutMargin(rtWidget, mgWidget); 108 XFA_RectWidthoutMargin(rtWidget, mgWidget);
115 } 109 }
116 CXFA_Caption caption = m_pDataAcc->GetCaption(); 110 CXFA_Caption caption = m_pDataAcc->GetCaption();
117 m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width, rtWidget.height); 111 m_rtCaption.Set(rtWidget.left, rtWidget.top, rtWidget.width, rtWidget.height);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 path.Create(); 237 path.Create();
244 CFX_RectF rect; 238 CFX_RectF rect;
245 m_pNormalWidget->GetWidgetRect(rect); 239 m_pNormalWidget->GetWidgetRect(rect);
246 path.AddRectangle(0, 0, rect.width, rect.height); 240 path.AddRectangle(0, 0, rect.width, rect.height);
247 pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); 241 pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix);
248 } 242 }
249 } else if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HilitePush) { 243 } else if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HilitePush) {
250 } 244 }
251 return FWL_ERR_Succeeded; 245 return FWL_ERR_Succeeded;
252 } 246 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698