Removed the SAFE_DELETE macro.

In most case the assignment to null was not necessary since it was easily provable that the (local) variable wouldn't have referenced after that anyway.
This commit is contained in:
Lorenzo Marcantonio 2013-04-28 16:28:13 +02:00
parent 3c5c795c1f
commit 3b1ddd952f
10 changed files with 25 additions and 22 deletions

View File

@ -168,7 +168,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
{
SAFE_DELETE( m_currentScreen );
delete m_currentScreen;
m_currentScreen = NULL;
m_auimgr.UnInit();
}

View File

@ -868,7 +868,7 @@ bool LIB_COMPONENT::LoadDrawEntries( LINE_READER& aLineReader, wxString& aErrorM
{
aErrorMsg.Printf( wxT( "error <%s> in DRAW command %c" ),
GetChars( aErrorMsg ), line[0] );
SAFE_DELETE( newEntry );
delete newEntry;
// Flush till end of draw section
do
@ -913,7 +913,7 @@ bool LIB_COMPONENT::LoadField( LINE_READER& aLineReader, wxString& aErrorMsg )
if( !field->Load( aLineReader, aErrorMsg ) )
{
SAFE_DELETE( field );
delete field;
return false;
}
@ -931,7 +931,7 @@ bool LIB_COMPONENT::LoadField( LINE_READER& aLineReader, wxString& aErrorMsg )
if( field->GetId() == VALUE )
m_name = field->GetText();
SAFE_DELETE( field );
delete field;
}
else
{

View File

@ -247,7 +247,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
wxStaticText* text = new wxStaticText( m_matrixPanel, -1, wxT( "W" ), pos );
int text_height = text->GetRect().GetHeight();
bitmap_size.y = std::max( bitmap_size.y, text_height );
SAFE_DELETE( text );
delete text;
// compute the Y pos interval:
pos.y = text_height;

View File

@ -110,7 +110,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
if( textItem->GetText().IsEmpty() )
{
SAFE_DELETE( textItem );
delete textItem;
return NULL;
}

View File

@ -293,7 +293,8 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
// Clear the screen before open a new file
if( g_RootSheet )
{
SAFE_DELETE( g_RootSheet );
delete g_RootSheet;
g_RootSheet = NULL;
}
CreateScreens();

View File

@ -143,7 +143,8 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event )
// Delete previous library component, if any
if( m_component )
{
SAFE_DELETE( m_component );
delete m_component;
m_component = NULL;
m_aliasName.Empty();
}
@ -212,7 +213,7 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_ALIAS* aEntry, CMP_LIBRARY* aLib
if( m_component )
{
SAFE_DELETE( m_component );
delete m_component;
m_aliasName.Empty();
}
@ -574,7 +575,8 @@ All changes will be lost. Discard changes?" ) ) )
}
else
{
SAFE_DELETE( m_component );
delete m_component;
m_component = NULL;
m_aliasName.Empty();
}
@ -660,7 +662,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
if( m_component )
{
SAFE_DELETE( m_component );
delete m_component;
m_aliasName.Empty();
}

View File

@ -232,7 +232,7 @@ again." );
if( !itemLoaded )
{
SAFE_DELETE( item );
delete item;
}
else
{

View File

@ -274,10 +274,14 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle,
SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
{
SetScreen( NULL );
SAFE_DELETE( m_CurrentSheet ); // a SCH_SHEET_PATH, on the heap.
SAFE_DELETE( m_undoItem );
SAFE_DELETE( g_RootSheet );
SAFE_DELETE( m_findReplaceData );
delete m_CurrentSheet; // a SCH_SHEET_PATH, on the heap.
delete m_undoItem;
delete g_RootSheet;
delete m_findReplaceData;
m_CurrentSheet = NULL;
m_undoItem = NULL;
g_RootSheet = NULL;
m_findReplaceData = NULL;
CMP_LIBRARY::RemoveAllLibraries();
}

View File

@ -292,7 +292,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
if( item->IsNew() )
{
SAFE_DELETE( item );
delete item;
}
else if( item->IsMoving() || item->IsResized() )
{

View File

@ -51,11 +51,6 @@
#include <wx/overlay.h>
#endif
// C++ guarantees that operator delete checks its argument for null-ness
#ifndef SAFE_DELETE
#define SAFE_DELETE( p ) delete (p); (p) = NULL;
#endif
// Option for dialog boxes
#define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER