Fixed a minor memleak.

This commit is contained in:
Maciej Suminski 2015-08-07 18:20:49 +02:00
parent 03d8d6850a
commit 0bd85fd8d1
2 changed files with 16 additions and 7 deletions

View File

@ -71,7 +71,8 @@ public:
SELECTION_TOOL::SELECTION_TOOL() :
TOOL_INTERACTIVE( "pcbnew.InteractiveSelection" ),
m_frame( NULL ), m_additive( false ), m_multiple( false ), m_editModules( false ),
m_locked( true ), m_menu( this ), m_contextMenu( NULL ), m_selectMenu( NULL )
m_locked( true ), m_menu( this ), m_contextMenu( NULL ), m_selectMenu( NULL ),
m_zoomMenu( NULL ), m_gridMenu( NULL )
{
// Do not leave uninitialized members:
m_preliminary = false;
@ -83,6 +84,8 @@ SELECTION_TOOL::~SELECTION_TOOL()
delete m_selection.group;
delete m_contextMenu;
delete m_selectMenu;
delete m_zoomMenu;
delete m_gridMenu;
}
@ -104,10 +107,13 @@ bool SELECTION_TOOL::Init()
m_menu.AddItem( COMMON_ACTIONS::zoomOut , SELECTION_CONDITIONS::ShowAlways, 1000 );
m_menu.AddItem( COMMON_ACTIONS::zoomFitScreen , SELECTION_CONDITIONS::ShowAlways, 1000 );
m_menu.AddMenu( new ZOOM_MENU( getEditFrame<PCB_BASE_FRAME>() ), _( "Zoom" ),
false, SELECTION_CONDITIONS::ShowAlways, 1000 );
m_menu.AddMenu( new GRID_MENU( getEditFrame<PCB_BASE_FRAME>() ), _( "Grid" ),
false, SELECTION_CONDITIONS::ShowAlways, 1000 );
PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>();
m_zoomMenu = new ZOOM_MENU( frame );
m_menu.AddMenu( m_zoomMenu, _( "Zoom" ), false, SELECTION_CONDITIONS::ShowAlways, 1000 );
m_gridMenu = new GRID_MENU( frame );
m_menu.AddMenu( m_gridMenu, _( "Grid" ), false, SELECTION_CONDITIONS::ShowAlways, 1000 );
return true;
}

View File

@ -39,6 +39,8 @@ class SELECTION_AREA;
class BOARD_ITEM;
class GENERAL_COLLECTOR;
class SELECT_MENU;
class ZOOM_MENU;
class GRID_MENU;
namespace KIGFX
{
@ -345,10 +347,11 @@ private:
/// Menu displayed by the tool.
CONDITIONAL_MENU m_menu;
// TODO
/// Pointers to context menus
CONTEXT_MENU* m_contextMenu;
SELECT_MENU* m_selectMenu;
ZOOM_MENU* m_zoomMenu;
GRID_MENU* m_gridMenu;
};
#endif