diff options
author | Noel Grandin <noel@peralex.com> | 2021-02-24 10:05:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-24 11:59:01 +0100 |
commit | bcb15a129d8befa5df5767b09e93b5003332ae71 (patch) | |
tree | e3714461ed12437a64d76b876ee733d2a777b9a0 | |
parent | cd6d3a3d434e39c250418ed5547ff3af1b0f7482 (diff) |
use unique_ptr in SplitWindow
Change-Id: Ic17c5a8923190d3be99105cbf47de6b83009145e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111443
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/vcl/splitwin.hxx | 2 | ||||
-rw-r--r-- | vcl/source/window/splitwin.cxx | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/include/vcl/splitwin.hxx b/include/vcl/splitwin.hxx index c88f015a9471..c41376109b87 100644 --- a/include/vcl/splitwin.hxx +++ b/include/vcl/splitwin.hxx @@ -48,7 +48,7 @@ private: std::unique_ptr<ImplSplitSet> mpMainSet; ImplSplitSet* mpBaseSet; ImplSplitSet* mpSplitSet; - tools::Long* mpLastSizes; + std::unique_ptr<tools::Long[]> mpLastSizes; tools::Rectangle maDragRect; tools::Long mnDX; tools::Long mnDY; diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index d43eccb2725c..ad7ae0f981f6 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -1762,7 +1762,7 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt ) { std::vector< ImplSplitItem >& rItems = mpSplitSet->mvItems; sal_uInt16 nItems = mpSplitSet->mvItems.size(); - mpLastSizes = new tools::Long[nItems*2]; + mpLastSizes.reset(new tools::Long[nItems*2]); for ( sal_uInt16 i = 0; i < nItems; i++ ) { mpLastSizes[i*2] = rItems[i].mnSize; @@ -2012,8 +2012,7 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) if ( rTEvt.IsTrackingEnded() ) { - delete [] mpLastSizes; - mpLastSizes = nullptr; + mpLastSizes.reset(); mpSplitSet = nullptr; mnMouseOff = 0; mnMStartPos = 0; |