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

Side by Side Diff: fpdfsdk/src/pdfwindow/PWL_ListBox.cpp

Issue 1192743004: Cleanup: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 6 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
« no previous file with comments | « fpdfsdk/src/javascript/app.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_Wnd.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "../../include/pdfwindow/PDFWindow.h" 7 #include "../../include/pdfwindow/PDFWindow.h"
8 #include "../../include/pdfwindow/PWL_Wnd.h" 8 #include "../../include/pdfwindow/PWL_Wnd.h"
9 #include "../../include/pdfwindow/PWL_ListBox.h" 9 #include "../../include/pdfwindow/PWL_ListBox.h"
10 #include "../../include/pdfwindow/PWL_Utils.h" 10 #include "../../include/pdfwindow/PWL_Utils.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 m_bHoverSel(FALSE), 83 m_bHoverSel(FALSE),
84 m_pFillerNotify(NULL) 84 m_pFillerNotify(NULL)
85 { 85 {
86 m_pList = IFX_List::NewList(); 86 m_pList = IFX_List::NewList();
87 87
88 ASSERT(m_pList != NULL); 88 ASSERT(m_pList != NULL);
89 } 89 }
90 90
91 CPWL_ListBox::~CPWL_ListBox() 91 CPWL_ListBox::~CPWL_ListBox()
92 { 92 {
93 » IFX_List::DelList(m_pList); 93 IFX_List::DelList(m_pList);
94 94 delete m_pListNotify;
95 » if (m_pListNotify) 95 m_pListNotify = NULL;
96 » {
97 » » delete m_pListNotify;
98 » » m_pListNotify = NULL;
99 » }
100 } 96 }
101 97
102 CFX_ByteString CPWL_ListBox::GetClassName() const 98 CFX_ByteString CPWL_ListBox::GetClassName() const
103 { 99 {
104 return "CPWL_ListBox"; 100 return "CPWL_ListBox";
105 } 101 }
106 102
107 void CPWL_ListBox::OnCreated() 103 void CPWL_ListBox::OnCreated()
108 { 104 {
109 if (m_pList) 105 if (m_pList)
110 { 106 {
111 » » if (m_pListNotify) delete m_pListNotify; 107 » » delete m_pListNotify;
112 108
113 m_pList->SetFontMap(GetFontMap()); 109 m_pList->SetFontMap(GetFontMap());
114 m_pList->SetNotify(m_pListNotify = new CPWL_List_Notify(this)); 110 m_pList->SetNotify(m_pListNotify = new CPWL_List_Notify(this));
115 111
116 SetHoverSel(HasFlag(PLBS_HOVERSEL)); 112 SetHoverSel(HasFlag(PLBS_HOVERSEL));
117 m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL)); 113 m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL));
118 m_pList->SetFontSize(GetCreationParam().fFontSize); 114 m_pList->SetFontSize(GetCreationParam().fFontSize);
119 115
120 m_bHoverSel = HasFlag(PLBS_HOVERSEL); 116 m_bHoverSel = HasFlag(PLBS_HOVERSEL);
121 } 117 }
122 } 118 }
123 119
124 void CPWL_ListBox::OnDestroy() 120 void CPWL_ListBox::OnDestroy()
125 { 121 {
126 » if (m_pListNotify) 122 delete m_pListNotify;
127 » { 123 m_pListNotify = NULL;
128 » » delete m_pListNotify;
129 » » m_pListNotify = NULL;
130 » }
131 } 124 }
132 125
133 void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream) 126 void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream)
134 { 127 {
135 CPWL_Wnd::GetThisAppearanceStream(sAppStream); 128 CPWL_Wnd::GetThisAppearanceStream(sAppStream);
136 129
137 CFX_ByteTextBuf sListItems; 130 CFX_ByteTextBuf sListItems;
138 131
139 if (m_pList) 132 if (m_pList)
140 { 133 {
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 else 589 else
597 { 590 {
598 m_pList->OnVK_UP(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag)); 591 m_pList->OnVK_UP(IsSHIFTpressed(nFlag),IsCTRLpressed(nFlag));
599 } 592 }
600 593
601 FX_BOOL bExit = FALSE; 594 FX_BOOL bExit = FALSE;
602 OnNotifySelChanged(FALSE,bExit, nFlag); 595 OnNotifySelChanged(FALSE,bExit, nFlag);
603 return TRUE; 596 return TRUE;
604 } 597 }
605 598
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/app.cpp ('k') | fpdfsdk/src/pdfwindow/PWL_Wnd.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698