From 6f1123d3ddd6108f486964182f92854db9a13a7e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 20 Jan 2017 15:02:32 +0200 Subject: use rtl::Reference in Ruler instead of manual acquire/release Change-Id: I7815a0a3c01fce57b4798ac1dbf501e20444c61d --- include/svtools/ruler.hxx | 3 ++- svtools/source/control/ruler.cxx | 14 ++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx index 1c5b0cdea845..aa2fc2cade5d 100644 --- a/include/svtools/ruler.hxx +++ b/include/svtools/ruler.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SVTOOLS_RULER_HXX #include +#include #include #include #include @@ -660,7 +661,7 @@ private: std::unique_ptr mxCurrentHitTest; std::unique_ptr mxPreviousHitTest; - SvtRulerAccessible* pAccContext; + rtl::Reference mxAccContext; SVT_DLLPRIVATE void ImplVDrawLine(vcl::RenderContext& rRenderContext, long nX1, long nY1, long nX2, long nY2 ); SVT_DLLPRIVATE void ImplVDrawRect(vcl::RenderContext& rRenderContext, long nX1, long nY1, long nX2, long nY2 ); diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 25fa30af1422..0981bc1b331e 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -283,7 +283,6 @@ void Ruler::ImplInit( WinBits nWinBits ) aDefSize.Width() = nDefHeight; SetOutputSizePixel( aDefSize ); SetType(WINDOW_RULER); - pAccContext = nullptr; } Ruler::Ruler( vcl::Window* pParent, WinBits nWinStyle ) : @@ -334,11 +333,7 @@ void Ruler::dispose() mpSaveData = nullptr; delete mpDragData; mpDragData = nullptr; - if( pAccContext ) - { - pAccContext->release(); - pAccContext = nullptr; - } + mxAccContext.clear(); Window::dispose(); } @@ -2827,10 +2822,9 @@ uno::Reference< XAccessible > Ruler::CreateAccessible() { aStr = SvtResId(STR_SVT_ACC_RULER_VERT_NAME); } - pAccContext = new SvtRulerAccessible( xAccParent, *this, aStr ); - pAccContext->acquire(); - this->SetAccessible(pAccContext); - return pAccContext; + mxAccContext = new SvtRulerAccessible( xAccParent, *this, aStr ); + this->SetAccessible(mxAccContext.get()); + return mxAccContext.get(); } else return uno::Reference< XAccessible >(); -- cgit