Use wxDELETE() and wxDELETEA() when possible.

Use wxDELETE[A]() functions which automatically NULL out their arguments after
deleting them instead of doing it manually.

Closes #9685.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-06-20 18:18:23 +00:00
parent 9ac34ac915
commit 5276b0a53c
162 changed files with 259 additions and 709 deletions

View File

@@ -386,8 +386,7 @@ bool wxApp::RegisterWindowClasses( HAB vHab )
//
void wxApp::CleanUp()
{
delete[] wxBuffer;
wxBuffer = NULL;
wxDELETEA(wxBuffer);
//
// PM-SPECIFIC CLEANUP
@@ -414,8 +413,7 @@ void wxApp::CleanUp()
// TODO: ::DeleteObject( wxDisableButtonBrush );
}
delete wxWinHandleHash;
wxWinHandleHash = NULL;
wxDELETE(wxWinHandleHash);
// Delete Message queue
if (wxTheApp->m_hMq)

View File

@@ -84,11 +84,7 @@ void wxBitmapRefData::Free()
wxLogLastError(wxT("GpiDeleteBitmap(hbitmap)"));
}
}
if (m_pBitmapMask)
{
delete m_pBitmapMask;
m_pBitmapMask = NULL;
}
wxDELETE(m_pBitmapMask);
} // end of wxBitmapRefData::Free
// ----------------------------------------------------------------------------

View File

@@ -180,11 +180,7 @@ bool wxDialog::Show( bool bShow )
// and we will lose activation
m_modalData->ExitLoop();
#if 0
if (m_pWindowDisabler)
{
delete m_pWindowDisabler;
m_pWindowDisabler = NULL;
}
wxDELETE(m_pWindowDisabler);
#endif
}

View File

@@ -140,8 +140,7 @@ public:
~CListItemInternalData()
{
delete m_pAttr;
m_pAttr = NULL;
wxDELETE(m_pAttr);
}
wxListItemAttr* m_pAttr;
@@ -965,8 +964,7 @@ wxListCtrl::~wxListCtrl ()
{
m_pTextCtrl->SetHWND(0);
m_pTextCtrl->UnsubclassWin();
delete m_pTextCtrl;
m_pTextCtrl = NULL;
wxDELETE(m_pTextCtrl);
}
if (m_bOwnsImageListNormal)

View File

@@ -70,8 +70,7 @@ void wxSystemSettingsModule::OnExit()
{
sm_optionNames.Clear();
sm_optionValues.Clear();
delete gs_fontDefault;
gs_fontDefault = NULL;
wxDELETE(gs_fontDefault);
}
wxColour wxSystemSettingsNative::GetColour(

View File

@@ -141,9 +141,7 @@ bool wxStaticBitmap::ImageIsOk() const
void wxStaticBitmap::Free()
{
if (m_pImage)
delete m_pImage;
m_pImage = NULL;
wxDELETE(m_pImage);
} // end of wxStaticBitmap::Free
wxSize wxStaticBitmap::DoGetBestSize() const

View File

@@ -423,11 +423,7 @@ bool wxToolBar::Create( wxWindow* pParent,
wxToolBar::~wxToolBar()
{
if (m_pToolTip)
{
delete m_pToolTip;
m_pToolTip = NULL;
}
wxDELETE(m_pToolTip);
} // end of wxToolBar::~wxToolBar
bool wxToolBar::Realize()

View File

@@ -80,11 +80,7 @@ public:
wxTreeItemInternalData() {}
~wxTreeItemInternalData()
{
if(m_pAttr)
{
delete m_pAttr;
m_pAttr = NULL;
}
wxDELETE(m_pAttr);
}
wxTreeItemAttr* m_pAttr;

View File

@@ -3038,11 +3038,7 @@ bool wxWindowOS2::HandleDestroy()
// Delete our drop target if we've got one
//
#if wxUSE_DRAG_AND_DROP
if (m_dropTarget != NULL)
{
delete m_dropTarget;
m_dropTarget = NULL;
}
wxDELETE(m_dropTarget);
#endif // wxUSE_DRAG_AND_DROP
//