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

loplugin:useuniqueptr in NWPixmapCache

Change-Id: Ibf9f5c3ec3ea502bb93942516936ff844235b4d3
Reviewed-on: https://gerrit.libreoffice.org/49130Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 6bec9bf0
...@@ -343,13 +343,13 @@ class NWPixmapCache ...@@ -343,13 +343,13 @@ class NWPixmapCache
int m_size; int m_size;
int m_idx; int m_idx;
int m_screen; int m_screen;
NWPixmapCacheData* pData; std::unique_ptr<NWPixmapCacheData[]> pData;
public: public:
explicit NWPixmapCache( SalX11Screen nScreen ); explicit NWPixmapCache( SalX11Screen nScreen );
~NWPixmapCache(); ~NWPixmapCache();
void SetSize( int n) 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; } int GetSize() const { return m_size; }
bool Find( ControlType aType, ControlState aState, const tools::Rectangle& r_pixmapRect, GdkX11Pixmap** pPixmap, GdkX11Pixmap** pMask ); bool Find( ControlType aType, ControlState aState, const tools::Rectangle& r_pixmapRect, GdkX11Pixmap** pPixmap, GdkX11Pixmap** pMask );
...@@ -392,13 +392,11 @@ NWPixmapCache::~NWPixmapCache() ...@@ -392,13 +392,11 @@ NWPixmapCache::~NWPixmapCache()
{ {
if( gWidgetData[m_screen].gNWPixmapCacheList ) if( gWidgetData[m_screen].gNWPixmapCacheList )
gWidgetData[m_screen].gNWPixmapCacheList->RemoveCache(this); gWidgetData[m_screen].gNWPixmapCacheList->RemoveCache(this);
delete[] pData;
} }
void NWPixmapCache::ThemeChanged() void NWPixmapCache::ThemeChanged()
{ {
// throw away cached pixmaps // throw away cached pixmaps
int i; for(int i=0; i<m_size; i++)
for(i=0; i<m_size; i++)
pData[i].SetPixmap( nullptr, nullptr ); pData[i].SetPixmap( nullptr, nullptr );
} }
......
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