diff --git a/gerbview/gerbview_draw_panel_gal.cpp b/gerbview/gerbview_draw_panel_gal.cpp index 256aad4f2b..c506099cad 100644 --- a/gerbview/gerbview_draw_panel_gal.cpp +++ b/gerbview/gerbview_draw_panel_gal.cpp @@ -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() ); diff --git a/include/class_draw_panel_gal.h b/include/class_draw_panel_gal.h index 3e33b67c87..b12c4b3822 100644 --- a/include/class_draw_panel_gal.h +++ b/include/class_draw_panel_gal.h @@ -35,6 +35,7 @@ #include #include #include +#include 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 m_painter; /// Control for VIEW (moving, zooming, etc.) KIGFX::WX_VIEW_CONTROLS* m_viewControls; diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index c4efe7e085..8f671b9d46 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -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; }