From 3b7245007d8c6bbe2cc095ec1c4ce37fd6d05b87 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 15 Jan 2018 16:06:59 +0200 Subject: loplugin:useuniqueptr in X11SalVirtualDevice Change-Id: I812fb31ec802d2c20e2e82693be127d42df73a69 --- vcl/inc/unx/salvd.h | 2 +- vcl/unx/generic/gdi/salvd.cxx | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h index 49b3ddff2d02..dbc489f63aab 100644 --- a/vcl/inc/unx/salvd.h +++ b/vcl/inc/unx/salvd.h @@ -32,7 +32,7 @@ class X11SalGraphics; class X11SalVirtualDevice : public SalVirtualDevice { SalDisplay *pDisplay_; - X11SalGraphics *pGraphics_; + std::unique_ptr pGraphics_; Pixmap hDrawable_; SalX11Screen m_nXScreen; diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index 09367e1e8a25..3be1449de90f 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -171,8 +171,7 @@ X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics const * pGraphics, long &nD X11SalVirtualDevice::~X11SalVirtualDevice() { - delete pGraphics_; - pGraphics_ = nullptr; + pGraphics_.reset(); if( GetDrawable() && !bExternPixmap_ ) XFreePixmap( GetXDisplay(), GetDrawable() ); @@ -186,7 +185,7 @@ SalGraphics* X11SalVirtualDevice::AcquireGraphics() if( pGraphics_ ) bGraphics_ = true; - return pGraphics_; + return pGraphics_.get(); } void X11SalVirtualDevice::ReleaseGraphics( SalGraphics* ) -- cgit