Kaydet (Commit) 1287081f authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in GtkSalFrame

Change-Id: Ia98080d5c214824624ca4cbe875038374919f662
Reviewed-on: https://gerrit.libreoffice.org/49132Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 1b67ad6f
......@@ -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;
......
......@@ -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 );
......
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment