summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-20 15:02:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-23 07:56:34 +0200
commit6f1123d3ddd6108f486964182f92854db9a13a7e (patch)
tree37997f8b08a33bef98a771997fb6712a97761459
parentbbd8c94967a4d227be46c1e777efd5b4bcf95429 (diff)
use rtl::Reference in Ruler
instead of manual acquire/release Change-Id: I7815a0a3c01fce57b4798ac1dbf501e20444c61d
-rw-r--r--include/svtools/ruler.hxx3
-rw-r--r--svtools/source/control/ruler.cxx14
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 >();