summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-04 12:20:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-05 09:30:14 +0200
commitde688dd0efdc39f6f7b3d98631d5bd08d060b8cc (patch)
treee6646982d733daa1dcaa1d1e22498c4e42d90f43
parentf338432f2eced2605ae555c646a22e3b5e4162b1 (diff)
loplugin:useuniqueptr in NWPaintGTKScrollbar
Change-Id: I3d0f124c1513ddeca1cefbc68e08883af95e343d Reviewed-on: https://gerrit.libreoffice.org/60000 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--vcl/unx/gtk/salnativewidgets-gtk.cxx7
-rw-r--r--vcl/workben/vcldemo.cxx5
2 files changed, 5 insertions, 7 deletions
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index 539d8cb5d897..f932cd4ba47c 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -1853,7 +1853,7 @@ bool GtkSalGraphics::NWPaintGTKScrollbar( ControlPart nPart,
{
assert(aValue.getType() == ControlType::Scrollbar);
const ScrollbarValue& rScrollbarVal = static_cast<const ScrollbarValue&>(aValue);
- GdkX11Pixmap* pixmap = nullptr;
+ std::unique_ptr<GdkX11Pixmap> pixmap;
tools::Rectangle pixmapRect, scrollbarRect;
GtkStateType stateType;
GtkShadowType shadowType;
@@ -2029,7 +2029,7 @@ bool GtkSalGraphics::NWPaintGTKScrollbar( ControlPart nPart,
// as multiple paints are required for the scrollbar
// painting them directly to the window flickers
- pixmap = NWGetPixmapFromScreen( pixmapRect );
+ pixmap.reset( NWGetPixmapFromScreen( pixmapRect ) );
if( ! pixmap )
return false;
x = y = 0;
@@ -2158,8 +2158,7 @@ bool GtkSalGraphics::NWPaintGTKScrollbar( ControlPart nPart,
arrowRect.GetWidth(), arrowRect.GetHeight() );
}
- bool bRet = NWRenderPixmapToScreen( pixmap, nullptr, pixmapRect );
- delete pixmap;
+ bool bRet = NWRenderPixmapToScreen( pixmap.get(), nullptr, pixmapRect );
return bRet;
}
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index ba27b77bdaab..f36009e200c9 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -636,8 +636,8 @@ public:
}
// DX array rendering
- long *pItems = new long[aText.getLength()+10];
- rDev.GetTextArray(aText, pItems);
+ std::unique_ptr<long[]> pItems(new long[aText.getLength()+10]);
+ rDev.GetTextArray(aText, pItems.get());
for (long j = 0; j < aText.getLength(); ++j)
{
Point aTop = aTextRect.TopLeft();
@@ -649,7 +649,6 @@ public:
rDev.DrawLine(aTop,aBottom);
rDev.SetRasterOp(RasterOp::OverPaint);
}
- delete[] pItems;
aPos.Move(aTextRect.GetWidth() + 16, 0);
}