[Libreoffice-commits] core.git: vcl/unx
Noel Grandin
noel.grandin at collabora.co.uk
Fri Feb 2 09:44:13 UTC 2018
vcl/unx/gtk/salnativewidgets-gtk.cxx | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
New commits:
commit 861489720f335d7a396396932f873adc31825877
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Jan 29 09:34:34 2018 +0200
loplugin:useuniqueptr in NWPixmapCache
Change-Id: Ibf9f5c3ec3ea502bb93942516936ff844235b4d3
Reviewed-on: https://gerrit.libreoffice.org/49130
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index 7f09799c547b..1636037bb5b4 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -343,13 +343,13 @@ class NWPixmapCache
int m_size;
int m_idx;
int m_screen;
- NWPixmapCacheData* pData;
+ std::unique_ptr<NWPixmapCacheData[]> pData;
public:
explicit NWPixmapCache( SalX11Screen nScreen );
~NWPixmapCache();
void SetSize( int n)
- { delete [] pData; m_idx = 0; m_size = n; pData = new NWPixmapCacheData[m_size]; }
+ { m_idx = 0; m_size = n; pData.reset(new NWPixmapCacheData[m_size]); }
int GetSize() const { return m_size; }
bool Find( ControlType aType, ControlState aState, const tools::Rectangle& r_pixmapRect, GdkX11Pixmap** pPixmap, GdkX11Pixmap** pMask );
@@ -392,13 +392,11 @@ NWPixmapCache::~NWPixmapCache()
{
if( gWidgetData[m_screen].gNWPixmapCacheList )
gWidgetData[m_screen].gNWPixmapCacheList->RemoveCache(this);
- delete[] pData;
}
void NWPixmapCache::ThemeChanged()
{
// throw away cached pixmaps
- int i;
- for(i=0; i<m_size; i++)
+ for(int i=0; i<m_size; i++)
pData[i].SetPixmap( nullptr, nullptr );
}
More information about the Libreoffice-commits
mailing list