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

Side by Side Diff: xfa/fwl/core/fwl_noteimp.cpp

Issue 1925363002: Do not check pointers before deleting them. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase 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
« no previous file with comments | « xfa/fwl/core/fwl_formimp.cpp ('k') | xfa/fwl/core/fwl_widgetmgrimp.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 "xfa/fwl/core/fwl_noteimp.h" 7 #include "xfa/fwl/core/fwl_noteimp.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fwl/basewidget/fwl_tooltipctrlimp.h" 10 #include "xfa/fwl/basewidget/fwl_tooltipctrlimp.h"
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 } 863 }
864 CFWL_ToolTipContainer::~CFWL_ToolTipContainer() { 864 CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {
865 if (m_pToolTipImp) { 865 if (m_pToolTipImp) {
866 IFWL_ToolTip* pToolTip = 866 IFWL_ToolTip* pToolTip =
867 static_cast<IFWL_ToolTip*>(m_pToolTipImp->GetInterface()); 867 static_cast<IFWL_ToolTip*>(m_pToolTipImp->GetInterface());
868 pToolTip->Finalize(); 868 pToolTip->Finalize();
869 delete pToolTip; 869 delete pToolTip;
870 } 870 }
871 delete m_ToolTipDp; 871 delete m_ToolTipDp;
872 } 872 }
873
873 // static 874 // static
874 CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() { 875 CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() {
875 if (!s_pInstance) { 876 if (!s_pInstance)
876 s_pInstance = new CFWL_ToolTipContainer; 877 s_pInstance = new CFWL_ToolTipContainer;
877 }
878 return s_pInstance; 878 return s_pInstance;
879 } 879 }
880
880 // static 881 // static
881 void CFWL_ToolTipContainer::DeleteInstance() { 882 void CFWL_ToolTipContainer::DeleteInstance() {
882 if (s_pInstance) { 883 delete s_pInstance;
883 delete s_pInstance; 884 s_pInstance = NULL;
884 s_pInstance = NULL;
885 }
886 } 885 }
886
887 FX_ERR CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) { 887 FX_ERR CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) {
888 if (m_arrWidget.Find(pTarget) < 0) { 888 if (m_arrWidget.Find(pTarget) < 0) {
889 m_arrWidget.Add(pTarget); 889 m_arrWidget.Add(pTarget);
890 return FWL_ERR_Succeeded; 890 return FWL_ERR_Succeeded;
891 } 891 }
892 return FWL_ERR_Indefinite; 892 return FWL_ERR_Indefinite;
893 } 893 }
894 FX_ERR CFWL_ToolTipContainer::RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) { 894 FX_ERR CFWL_ToolTipContainer::RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) {
895 int index = m_arrWidget.Find(pTarget); 895 int index = m_arrWidget.Find(pTarget);
896 if (index >= 0) { 896 if (index >= 0) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) { 968 if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) {
969 m_pToolTipImp->Hide(); 969 m_pToolTipImp->Hide();
970 pCurTarget = NULL; 970 pCurTarget = NULL;
971 return TRUE; 971 return TRUE;
972 } 972 }
973 return FALSE; 973 return FALSE;
974 } 974 }
975 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() { 975 IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() {
976 return pCurTarget; 976 return pCurTarget;
977 } 977 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_formimp.cpp ('k') | xfa/fwl/core/fwl_widgetmgrimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698