diff options
-rw-r--r-- | include/svtools/ruler.hxx | 3 | ||||
-rw-r--r-- | 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 <svtools/svtdllapi.h> +#include <rtl/ref.hxx> #include <tools/link.hxx> #include <tools/fract.hxx> #include <vcl/window.hxx> @@ -660,7 +661,7 @@ private: std::unique_ptr<RulerSelection> mxCurrentHitTest; std::unique_ptr<RulerSelection> mxPreviousHitTest; - SvtRulerAccessible* pAccContext; + rtl::Reference<SvtRulerAccessible> 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 >(); |