Removed a few memory leaks.
This commit is contained in:
parent
75026d8754
commit
505b38416d
|
@ -220,6 +220,7 @@ set( PCB_COMMON_SRCS
|
|||
../pcbnew/class_zone_settings.cpp
|
||||
../pcbnew/classpcb.cpp
|
||||
../pcbnew/ratsnest_data.cpp
|
||||
../pcbnew/ratsnest_viewitem.cpp
|
||||
../pcbnew/collectors.cpp
|
||||
../pcbnew/netlist_reader.cpp
|
||||
../pcbnew/legacy_netlist_reader.cpp
|
||||
|
|
|
@ -36,10 +36,8 @@
|
|||
|
||||
using namespace KIGFX;
|
||||
|
||||
WORKSHEET_VIEWITEM::WORKSHEET_VIEWITEM( const std::string& aFileName, const std::string& aSheetName,
|
||||
const PAGE_INFO* aPageInfo, const TITLE_BLOCK* aTitleBlock ) :
|
||||
WORKSHEET_VIEWITEM::WORKSHEET_VIEWITEM( const PAGE_INFO* aPageInfo, const TITLE_BLOCK* aTitleBlock ) :
|
||||
EDA_ITEM( NOT_USED ), // this item is never added to a BOARD so it needs no type
|
||||
m_fileName( aFileName ), m_sheetName( aSheetName ),
|
||||
m_titleBlock( aTitleBlock ), m_pageInfo( aPageInfo ), m_sheetNumber( 1 ), m_sheetCount( 1 ) {}
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <climits>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cmath>
|
||||
|
||||
#include <math/math_util.h>
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@ class GAL;
|
|||
class WORKSHEET_VIEWITEM : public EDA_ITEM
|
||||
{
|
||||
public:
|
||||
WORKSHEET_VIEWITEM( const std::string& aFileName, const std::string& aSheetName,
|
||||
const PAGE_INFO* aPageInfo, const TITLE_BLOCK* aTitleBlock );
|
||||
WORKSHEET_VIEWITEM( const PAGE_INFO* aPageInfo, const TITLE_BLOCK* aTitleBlock );
|
||||
|
||||
/**
|
||||
* Function SetFileName()
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include <reporter.h>
|
||||
#include <base_units.h>
|
||||
#include <ratsnest_data.h>
|
||||
#include <ratsnest_viewitem.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <colors_selection.h>
|
||||
|
@ -104,7 +106,13 @@ BOARD::BOARD() :
|
|||
|
||||
SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() );
|
||||
|
||||
// Initialize ratsnest
|
||||
m_ratsnest = new RN_DATA( this );
|
||||
m_ratsnestViewItem = new KIGFX::RATSNEST_VIEWITEM( m_ratsnest );
|
||||
|
||||
// Initialize view item for displaying worksheet frame
|
||||
m_worksheetViewItem = new KIGFX::WORKSHEET_VIEWITEM( &m_paper, &m_titles );
|
||||
m_worksheetViewItem->SetFileName( std::string( m_fileName.mb_str() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,10 +124,11 @@ BOARD::~BOARD()
|
|||
Delete( area_to_remove );
|
||||
}
|
||||
|
||||
delete m_worksheetViewItem;
|
||||
delete m_ratsnestViewItem;
|
||||
delete m_ratsnest;
|
||||
|
||||
m_FullRatsnest.clear();
|
||||
|
||||
m_LocalRatsnest.clear();
|
||||
|
||||
DeleteMARKERs();
|
||||
|
|
|
@ -58,6 +58,12 @@ class NETLIST;
|
|||
class REPORTER;
|
||||
class RN_DATA;
|
||||
|
||||
namespace KIGFX
|
||||
{
|
||||
class RATSNEST_VIEWITEM;
|
||||
class WORKSHEET_VIEWITEM;
|
||||
}
|
||||
|
||||
|
||||
// non-owning container of item candidates when searching for items on the same track.
|
||||
typedef std::vector< TRACK* > TRACK_PTRS;
|
||||
|
@ -227,6 +233,8 @@ private:
|
|||
EDA_RECT m_BoundingBox;
|
||||
NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints ..
|
||||
RN_DATA* m_ratsnest;
|
||||
KIGFX::RATSNEST_VIEWITEM* m_ratsnestViewItem; ///< VIEW_ITEM that draws ratsnest
|
||||
KIGFX::WORKSHEET_VIEWITEM* m_worksheetViewItem; ///< VIEW_ITEM that draws worksheet frame
|
||||
|
||||
BOARD_DESIGN_SETTINGS m_designSettings;
|
||||
ZONE_SETTINGS m_zoneSettings;
|
||||
|
@ -367,6 +375,24 @@ public:
|
|||
return m_ratsnest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetRatsnestViewItem()
|
||||
* returns VIEW_ITEM responsible for drawing the ratsnest for the board.
|
||||
*/
|
||||
KIGFX::RATSNEST_VIEWITEM* GetRatsnestViewItem() const
|
||||
{
|
||||
return m_ratsnestViewItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetWorksheetViewItem()
|
||||
* returns VIEW_ITEM responsible for drawing the worksheet frame.
|
||||
*/
|
||||
KIGFX::WORKSHEET_VIEWITEM* GetWorksheetViewItem() const
|
||||
{
|
||||
return m_worksheetViewItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function DeleteMARKERs
|
||||
* deletes ALL MARKERS from the board.
|
||||
|
|
|
@ -596,26 +596,22 @@ void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
|
|||
view->Add( zone );
|
||||
}
|
||||
|
||||
// Add an entry for the worksheet layout
|
||||
KIGFX::WORKSHEET_VIEWITEM* worksheet = new KIGFX::WORKSHEET_VIEWITEM(
|
||||
std::string( aBoard->GetFileName().mb_str() ),
|
||||
std::string( GetScreenDesc().mb_str() ),
|
||||
&GetPageSettings(), &GetTitleBlock() );
|
||||
KIGFX::WORKSHEET_VIEWITEM* worksheet = aBoard->GetWorksheetViewItem();
|
||||
worksheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
|
||||
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
|
||||
if( screen != NULL )
|
||||
{
|
||||
worksheet->SetSheetNumber( GetScreen()->m_ScreenNumber );
|
||||
worksheet->SetSheetCount( GetScreen()->m_NumberOfScreens );
|
||||
worksheet->SetSheetNumber( screen->m_ScreenNumber );
|
||||
worksheet->SetSheetCount( screen->m_NumberOfScreens );
|
||||
}
|
||||
|
||||
view->Add( worksheet );
|
||||
view->Add( aBoard->GetRatsnestViewItem() );
|
||||
|
||||
// Add an entry for the ratsnest
|
||||
RN_DATA* ratsnest = aBoard->GetRatsnest();
|
||||
ratsnest->Recalculate();
|
||||
view->Add( new KIGFX::RATSNEST_VIEWITEM( ratsnest ) );
|
||||
|
||||
view->SetPanBoundary( worksheet->ViewBBox() );
|
||||
// Limit panning to the size of worksheet frame
|
||||
view->SetPanBoundary( aBoard->GetWorksheetViewItem()->ViewBBox() );
|
||||
view->RecacheAllItems( true );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
|
|
|
@ -338,9 +338,13 @@ void PNS_ROUTER::ClearWorld()
|
|||
if( m_placer )
|
||||
delete m_placer;
|
||||
|
||||
if( m_previewItems )
|
||||
delete m_previewItems;
|
||||
|
||||
m_clearanceFunc = NULL;
|
||||
m_world = NULL;
|
||||
m_placer = NULL;
|
||||
m_previewItems = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,10 +32,14 @@
|
|||
class PNS_SOLID : public PNS_ITEM
|
||||
{
|
||||
public:
|
||||
PNS_SOLID() : PNS_ITEM( SOLID )
|
||||
PNS_SOLID() : PNS_ITEM( SOLID ), m_shape( NULL )
|
||||
{
|
||||
m_movable = false;
|
||||
m_shape = NULL;
|
||||
}
|
||||
|
||||
~PNS_SOLID()
|
||||
{
|
||||
delete m_shape;
|
||||
}
|
||||
|
||||
PNS_ITEM* Clone() const;
|
||||
|
|
Loading…
Reference in New Issue