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

Side by Side Diff: fpdfsdk/src/fxedit/fxet_edit.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/fsdk_rendercontext.cpp ('k') | fpdfsdk/src/javascript/app.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/fxedit/fxet_stub.h" 7 #include "../../include/fxedit/fxet_stub.h"
8 #include "../../include/fxedit/fxet_edit.h" 8 #include "../../include/fxedit/fxet_edit.h"
9 9
10 #define FX_EDIT_UNDO_MAXITEM 10000 10 #define FX_EDIT_UNDO_MAXITEM 10000
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 m_bEnableUndo(TRUE), 964 m_bEnableUndo(TRUE),
965 m_bNotify(TRUE), 965 m_bNotify(TRUE),
966 m_bOprNotify(FALSE), 966 m_bOprNotify(FALSE),
967 m_pGroupUndoItem(NULL) 967 m_pGroupUndoItem(NULL)
968 { 968 {
969 ASSERT(pVT != NULL); 969 ASSERT(pVT != NULL);
970 } 970 }
971 971
972 CFX_Edit::~CFX_Edit() 972 CFX_Edit::~CFX_Edit()
973 { 973 {
974 » if (m_pVTProvide) 974 delete m_pVTProvide;
975 » { 975 m_pVTProvide = NULL;
976 » » delete m_pVTProvide; 976 delete m_pIterator;
977 » » m_pVTProvide = NULL; 977 m_pIterator = NULL;
978 » } 978 ASSERT(m_pGroupUndoItem == NULL);
979
980 » if (m_pIterator)
981 » {
982 » » delete m_pIterator;
983 » » m_pIterator = NULL;
984 » }
985
986 » ASSERT(m_pGroupUndoItem == NULL);
987 } 979 }
988 980
989 // public methods 981 // public methods
990 982
991 void CFX_Edit::Initialize() 983 void CFX_Edit::Initialize()
992 { 984 {
993 m_pVT->Initialize(); 985 m_pVT->Initialize();
994 SetCaret(m_pVT->GetBeginWordPlace()); 986 SetCaret(m_pVT->GetBeginWordPlace());
995 SetCaretOrigin(); 987 SetCaretOrigin();
996 } 988 }
997 989
998 void CFX_Edit::SetFontMap(IFX_Edit_FontMap * pFontMap) 990 void CFX_Edit::SetFontMap(IFX_Edit_FontMap * pFontMap)
999 { 991 {
1000 » if (m_pVTProvide) 992 delete m_pVTProvide;
1001 » » delete m_pVTProvide; 993 m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap));
1002
1003 » m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap));
1004 } 994 }
1005 995
1006 void CFX_Edit::SetVTProvider(IPDF_VariableText_Provider* pProvider) 996 void CFX_Edit::SetVTProvider(IPDF_VariableText_Provider* pProvider)
1007 { 997 {
1008 m_pVT->SetProvider(pProvider); 998 m_pVT->SetProvider(pProvider);
1009 } 999 }
1010 1000
1011 void CFX_Edit::SetNotify(IFX_Edit_Notify* pNotify) 1001 void CFX_Edit::SetNotify(IFX_Edit_Notify* pNotify)
1012 { 1002 {
1013 m_pNotify = pNotify; 1003 m_pNotify = pNotify;
(...skipping 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after
3583 } 3573 }
3584 } 3574 }
3585 3575
3586 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) 3576 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem)
3587 { 3577 {
3588 m_Undo.AddItem(pUndoItem); 3578 m_Undo.AddItem(pUndoItem);
3589 if (m_bOprNotify && m_pOprNotify) 3579 if (m_bOprNotify && m_pOprNotify)
3590 m_pOprNotify->OnAddUndo(pUndoItem); 3580 m_pOprNotify->OnAddUndo(pUndoItem);
3591 } 3581 }
3592 3582
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_rendercontext.cpp ('k') | fpdfsdk/src/javascript/app.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698