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:
@@ -237,8 +237,7 @@ bool wxHtmlCell::AdjustPagebreak(int *pagebreak,
|
||||
|
||||
void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
|
||||
{
|
||||
if (m_Link) delete m_Link;
|
||||
m_Link = NULL;
|
||||
wxDELETE(m_Link);
|
||||
if (link.GetHref() != wxEmptyString)
|
||||
m_Link = new wxHtmlLinkInfo(link);
|
||||
}
|
||||
|
||||
@@ -250,8 +250,7 @@ void wxHtmlParser::DestroyDOMTree()
|
||||
}
|
||||
m_Tags = m_CurTag = NULL;
|
||||
|
||||
delete m_TextPieces;
|
||||
m_TextPieces = NULL;
|
||||
wxDELETE(m_TextPieces);
|
||||
}
|
||||
|
||||
void wxHtmlParser::DoParsing()
|
||||
|
||||
@@ -205,8 +205,7 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
|
||||
for ( wxHtmlTagsCacheData::iterator i = Cache().begin();
|
||||
i != Cache().end(); ++i )
|
||||
{
|
||||
delete[] i->Name;
|
||||
i->Name = NULL;
|
||||
wxDELETEA(i->Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -469,14 +469,13 @@ bool wxHtmlWindow::DoSetPage(const wxString& source)
|
||||
SetBackgroundImage(wxNullBitmap);
|
||||
|
||||
m_Parser->SetDC(dc);
|
||||
if (m_Cell)
|
||||
{
|
||||
delete m_Cell;
|
||||
// notice that it's important to set m_Cell to NULL here before calling
|
||||
// Parse() below, even if it will be overwritten by its return value:
|
||||
// without this we may crash if it's used from inside Parse()
|
||||
m_Cell = NULL;
|
||||
}
|
||||
|
||||
// notice that it's important to set m_Cell to NULL here before calling
|
||||
// Parse() below, even if it will be overwritten by its return value as
|
||||
// without this we may crash if it's used from inside Parse(), so use
|
||||
// wxDELETE() and not just delete here
|
||||
wxDELETE(m_Cell);
|
||||
|
||||
m_Cell = (wxHtmlContainerCell*) m_Parser->Parse(newsrc);
|
||||
delete dc;
|
||||
m_Cell->SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
|
||||
|
||||
@@ -606,8 +606,7 @@ wxFont* wxHtmlWinParser::CreateCurrentFont()
|
||||
#endif
|
||||
))
|
||||
{
|
||||
delete *fontptr;
|
||||
*fontptr = NULL;
|
||||
wxDELETE(*fontptr);
|
||||
}
|
||||
|
||||
if (*fontptr == NULL)
|
||||
@@ -669,11 +668,7 @@ void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc)
|
||||
m_nbsp = 0;
|
||||
|
||||
m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
|
||||
if (m_EncConv)
|
||||
{
|
||||
delete m_EncConv;
|
||||
m_EncConv = NULL;
|
||||
}
|
||||
wxDELETE(m_EncConv);
|
||||
|
||||
if (enc == wxFONTENCODING_DEFAULT)
|
||||
return;
|
||||
@@ -738,8 +733,7 @@ void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc)
|
||||
wxLogError(_("Failed to display HTML document in %s encoding"),
|
||||
wxFontMapper::GetEncodingName(enc).c_str());
|
||||
m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
|
||||
delete m_EncConv;
|
||||
m_EncConv = NULL;
|
||||
wxDELETE(m_EncConv);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user