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:
@@ -7423,11 +7423,7 @@ wxRichTextImageBlock::wxRichTextImageBlock(const wxRichTextImageBlock& block):wx
|
||||
|
||||
wxRichTextImageBlock::~wxRichTextImageBlock()
|
||||
{
|
||||
if (m_data)
|
||||
{
|
||||
delete[] m_data;
|
||||
m_data = NULL;
|
||||
}
|
||||
wxDELETEA(m_data);
|
||||
}
|
||||
|
||||
void wxRichTextImageBlock::Init()
|
||||
@@ -7439,8 +7435,7 @@ void wxRichTextImageBlock::Init()
|
||||
|
||||
void wxRichTextImageBlock::Clear()
|
||||
{
|
||||
delete[] m_data;
|
||||
m_data = NULL;
|
||||
wxDELETEA(m_data);
|
||||
m_dataSize = 0;
|
||||
m_imageType = wxBITMAP_TYPE_INVALID;
|
||||
}
|
||||
@@ -7539,11 +7534,7 @@ bool wxRichTextImageBlock::Write(const wxString& filename)
|
||||
void wxRichTextImageBlock::Copy(const wxRichTextImageBlock& block)
|
||||
{
|
||||
m_imageType = block.m_imageType;
|
||||
if (m_data)
|
||||
{
|
||||
delete[] m_data;
|
||||
m_data = NULL;
|
||||
}
|
||||
wxDELETEA(m_data);
|
||||
m_dataSize = block.m_dataSize;
|
||||
if (m_dataSize == 0)
|
||||
return;
|
||||
@@ -7790,8 +7781,7 @@ bool wxRichTextBufferDataObject::GetDataHere(void *pBuf) const
|
||||
|
||||
bool wxRichTextBufferDataObject::SetData(size_t WXUNUSED(len), const void *buf)
|
||||
{
|
||||
delete m_richTextBuffer;
|
||||
m_richTextBuffer = NULL;
|
||||
wxDELETE(m_richTextBuffer);
|
||||
|
||||
wxString bufXML((const char*) buf, wxConvUTF8);
|
||||
|
||||
@@ -7802,8 +7792,7 @@ bool wxRichTextBufferDataObject::SetData(size_t WXUNUSED(len), const void *buf)
|
||||
{
|
||||
wxLogError(wxT("Could not read the buffer from an XML stream.\nYou may have forgotten to add the XML file handler."));
|
||||
|
||||
delete m_richTextBuffer;
|
||||
m_richTextBuffer = NULL;
|
||||
wxDELETE(m_richTextBuffer);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user