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

@@ -336,8 +336,7 @@ wxDialUpManagerImpl::Dial(const wxString &isp,
m_DialPId = (int)wxExecute(cmd, false, m_DialProcess);
if(m_DialPId == 0)
{
delete m_DialProcess;
m_DialProcess = NULL;
wxDELETE(m_DialProcess);
return false;
}
else
@@ -379,8 +378,7 @@ bool wxDialUpManagerImpl::EnableAutoCheckOnlineStatus(size_t nSeconds)
bool rc = m_timer->Start(nSeconds*1000);
if(! rc)
{
delete m_timer;
m_timer = NULL;
wxDELETE(m_timer);
}
return rc;
}
@@ -390,8 +388,7 @@ void wxDialUpManagerImpl::DisableAutoCheckOnlineStatus()
if(m_timer != NULL)
{
m_timer->Stop();
delete m_timer;
m_timer = NULL;
wxDELETE(m_timer);
}
}

View File

@@ -1465,9 +1465,7 @@ bool wxFontModule::OnInit()
void wxFontModule::OnExit()
{
delete g_fontHash;
g_fontHash = NULL;
wxDELETE(g_fontHash);
}
#endif // GTK 2.0/1.x

View File

@@ -91,8 +91,7 @@ public:
wxCHECK_RET( IsOk(),
"Inotify not initialized or invalid inotify descriptor" );
delete m_source;
m_source = NULL;
wxDELETE(m_source);
if ( close(m_ifd) != 0 )
{

View File

@@ -115,8 +115,7 @@ public:
wxLogSysError(_("Error closing kqueue instance"));
}
delete m_source;
m_source = NULL;
wxDELETE(m_source);
}
virtual bool DoAdd(wxSharedPtr<wxFSWatchEntryKq> watch)
@@ -419,11 +418,7 @@ wxKqueueFileSystemWatcher::wxKqueueFileSystemWatcher(const wxFileName& path,
{
if (!Init())
{
if (m_service)
{
delete m_service;
m_service = NULL;
}
wxDELETE(m_service);
return;
}

View File

@@ -236,8 +236,7 @@ wxDialUpManagerImpl::EnableAutoCheckOnlineStatus(size_t nSeconds)
bool rc = m_timer->Start(nSeconds*1000);
if(! rc)
{
delete m_timer;
m_timer = NULL;
wxDELETE(m_timer);
}
return rc;
}
@@ -247,8 +246,7 @@ wxDialUpManagerImpl::DisableAutoCheckOnlineStatus()
{
wxASSERT(m_timer != NULL);
m_timer->Stop();
delete m_timer;
m_timer = NULL;
wxDELETE(m_timer);
}

View File

@@ -570,8 +570,7 @@ bool wxSound::Create(int size, const wxByte* data)
Stop();
delete ms_backend;
ms_backend = NULL;
wxDELETE(ms_backend);
#if wxUSE_LIBSDL && wxUSE_PLUGINS
delete ms_backendSDL;
#endif