Fixed a memleak in GerbView
Changed m_painter PAINTER* to unique_ptr<PAINTER> to avoid confusion regarding the objection destruction.
This commit is contained in:
parent
a4440395be
commit
3a8b4a2fb7
|
@ -38,8 +38,8 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy
|
|||
{
|
||||
setDefaultLayerDeps();
|
||||
|
||||
m_painter = new KIGFX::GERBVIEW_PAINTER( m_gal );
|
||||
m_view->SetPainter( m_painter );
|
||||
m_painter.reset( new KIGFX::GERBVIEW_PAINTER( m_gal ) );
|
||||
m_view->SetPainter( m_painter.get() );
|
||||
|
||||
// Load display options (such as filled/outline display of items).
|
||||
auto frame = static_cast< GERBVIEW_FRAME* >( GetParentEDAFrame() );
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <wx/timer.h>
|
||||
#include <math/vector2d.h>
|
||||
#include <msgpanel.h>
|
||||
#include <memory>
|
||||
|
||||
class BOARD;
|
||||
class EDA_DRAW_FRAME;
|
||||
|
@ -271,7 +272,7 @@ protected:
|
|||
KIGFX::VIEW* m_view;
|
||||
|
||||
/// Contains information about how to draw items using GAL
|
||||
KIGFX::PAINTER* m_painter;
|
||||
std::unique_ptr<KIGFX::PAINTER> m_painter;
|
||||
|
||||
/// Control for VIEW (moving, zooming, etc.)
|
||||
KIGFX::WX_VIEW_CONTROLS* m_viewControls;
|
||||
|
|
|
@ -107,8 +107,8 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy
|
|||
setDefaultLayerOrder();
|
||||
setDefaultLayerDeps();
|
||||
|
||||
m_painter = new KIGFX::PCB_PAINTER( m_gal );
|
||||
m_view->SetPainter( m_painter );
|
||||
m_painter.reset( new KIGFX::PCB_PAINTER( m_gal ) );
|
||||
m_view->SetPainter( m_painter.get() );
|
||||
|
||||
// Load display options (such as filled/outline display of items).
|
||||
// Can be made only if the parent window is an EDA_DRAW_FRAME (or a derived class)
|
||||
|
@ -125,7 +125,6 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy
|
|||
|
||||
PCB_DRAW_PANEL_GAL::~PCB_DRAW_PANEL_GAL()
|
||||
{
|
||||
delete m_painter;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue