summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-29 09:49:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-02 11:46:40 +0100
commit1287081fa5c132057e01c60a26c6f64156e5bc73 (patch)
tree538cc28901f6117fbf786aafeb0678926435691e
parent1b67ad6ff8979d8851db1223886bb03745845755 (diff)
loplugin:useuniqueptr in GtkSalFrame
Change-Id: Ia98080d5c214824624ca4cbe875038374919f662 Reviewed-on: https://gerrit.libreoffice.org/49132 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--vcl/inc/unx/gtk/gtkframe.hxx4
-rw-r--r--vcl/unx/gtk/gtksalframe.cxx22
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx15
3 files changed, 17 insertions, 24 deletions
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 48e019c29770..0ae8250c82f6 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -186,7 +186,7 @@ class GtkSalFrame : public SalFrame
std::list< GtkSalFrame* > m_aChildren;
GdkWindowState m_nState;
SystemEnvData m_aSystemData;
- GtkSalGraphics *m_pGraphics;
+ std::unique_ptr<GtkSalGraphics> m_pGraphics;
bool m_bGraphics;
ModKeyFlags m_nKeyModifiers;
GdkCursor *m_pCurrentCursor;
@@ -201,7 +201,7 @@ class GtkSalFrame : public SalFrame
OUString m_aTitle;
OUString m_sWMClass;
- IMHandler* m_pIMHandler;
+ std::unique_ptr<IMHandler> m_pIMHandler;
Size m_aMaxSize;
Size m_aMinSize;
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 880e1244bd36..81e8eecb9a2d 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -783,9 +783,7 @@ void GtkSalFrame::InvalidateGraphics()
{
m_pGraphics->DeInit();
m_pGraphics->SetWindow(nullptr);
- delete m_pGraphics;
- m_pGraphics = nullptr;
- m_bGraphics = false;
+ m_pGraphics.reset();
}
}
@@ -803,7 +801,7 @@ GtkSalFrame::~GtkSalFrame()
gdk_region_destroy( m_pRegion );
}
- delete m_pIMHandler;
+ m_pIMHandler.reset();
GtkWidget *pEventWidget = getMouseEventWidget();
for (auto handler_id : m_aMouseSignalIds)
@@ -1327,16 +1325,16 @@ SalGraphics* GtkSalFrame::AcquireGraphics()
if( !m_pGraphics )
{
- m_pGraphics = new GtkSalGraphics( this, m_pWindow, m_nXScreen );
+ m_pGraphics.reset( new GtkSalGraphics( this, m_pWindow, m_nXScreen ) );
}
m_bGraphics = true;
- return m_pGraphics;
+ return m_pGraphics.get();
}
void GtkSalFrame::ReleaseGraphics( SalGraphics* pGraphics )
{
(void) pGraphics;
- assert( pGraphics == m_pGraphics );
+ assert( pGraphics == m_pGraphics.get() );
m_bGraphics = false;
}
@@ -2325,7 +2323,7 @@ void GtkSalFrame::SetInputContext( SalInputContext* pContext )
// create a new im context
if( ! m_pIMHandler )
- m_pIMHandler = new IMHandler( this );
+ m_pIMHandler.reset( new IMHandler( this ) );
}
void GtkSalFrame::EndExtTextInput( EndExtTextInputFlags nFlags )
@@ -2350,7 +2348,7 @@ void GtkSalFrame::UpdateSettings( AllSettings& rSettings )
if( ! m_pWindow )
return;
- GtkSalGraphics* pGraphics = m_pGraphics;
+ GtkSalGraphics* pGraphics = m_pGraphics.get();
bool bFreeGraphics = false;
if( ! pGraphics )
{
@@ -2432,11 +2430,7 @@ void GtkSalFrame::createNewWindow( ::Window aNewParent, bool bXEmbed, SalX11Scre
m_pGraphics->SetDrawable( None, m_nXScreen );
// first deinit frame
- if( m_pIMHandler )
- {
- delete m_pIMHandler;
- m_pIMHandler = nullptr;
- }
+ m_pIMHandler.reset();
if( m_pRegion )
{
gdk_region_destroy( m_pRegion );
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index e5236108df1c..bfdba2f717c1 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -823,7 +823,7 @@ GtkSalFrame::~GtkSalFrame()
cairo_region_destroy( m_pRegion );
}
- delete m_pIMHandler;
+ m_pIMHandler.reset();
//tdf#108705 remove grabs on event widget before
//destroying event widget
@@ -870,8 +870,7 @@ GtkSalFrame::~GtkSalFrame()
if( m_pForeignTopLevel )
g_object_unref( G_OBJECT( m_pForeignTopLevel) );
- delete m_pGraphics;
- m_pGraphics = nullptr;
+ m_pGraphics.reset();
if (m_pSurface)
cairo_surface_destroy(m_pSurface);
@@ -1301,7 +1300,7 @@ SalGraphics* GtkSalFrame::AcquireGraphics()
if( !m_pGraphics )
{
- m_pGraphics = new GtkSalGraphics( this, m_pWindow );
+ m_pGraphics.reset( new GtkSalGraphics( this, m_pWindow ) );
if (!m_pSurface)
{
AllocateFrame();
@@ -1310,13 +1309,13 @@ SalGraphics* GtkSalFrame::AcquireGraphics()
m_pGraphics->setSurface(m_pSurface, m_aFrameSize);
}
m_bGraphics = true;
- return m_pGraphics;
+ return m_pGraphics.get();
}
void GtkSalFrame::ReleaseGraphics( SalGraphics* pGraphics )
{
(void) pGraphics;
- assert( pGraphics == m_pGraphics );
+ assert( pGraphics == m_pGraphics.get() );
m_bGraphics = false;
}
@@ -2300,7 +2299,7 @@ void GtkSalFrame::SetInputContext( SalInputContext* pContext )
// create a new im context
if( ! m_pIMHandler )
- m_pIMHandler = new IMHandler( this );
+ m_pIMHandler.reset( new IMHandler( this ) );
}
void GtkSalFrame::EndExtTextInput( EndExtTextInputFlags nFlags )
@@ -2325,7 +2324,7 @@ void GtkSalFrame::UpdateSettings( AllSettings& rSettings )
if( ! m_pWindow )
return;
- GtkSalGraphics* pGraphics = m_pGraphics;
+ GtkSalGraphics* pGraphics = m_pGraphics.get();
bool bFreeGraphics = false;
if( ! pGraphics )
{