Commit 3b1ddd95 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

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.
parent 3c5c795c
......@@ -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();
}
......
......@@ -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
{
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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();
......
......@@ -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();
}
......
......@@ -232,7 +232,7 @@ again." );
if( !itemLoaded )
{
SAFE_DELETE( item );
delete item;
}
else
{
......
......@@ -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();
}
......
......@@ -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() )
{
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment