diff options
-rw-r--r-- | starmath/source/accessibility.cxx | 13 | ||||
-rw-r--r-- | starmath/source/accessibility.hxx | 5 |
2 files changed, 12 insertions, 6 deletions
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx index 2e81b188d5e7..d5e8217d61d4 100644 --- a/starmath/source/accessibility.cxx +++ b/starmath/source/accessibility.cxx @@ -1601,7 +1601,7 @@ bool SmEditViewForwarder::Paste() SmEditAccessible::SmEditAccessible( SmEditWindow *pEditWin ) : aAccName (SM_RESSTR(STR_CMDBOXWINDOW)), - pTextHelper (nullptr), + pTextHelper (), pWin (pEditWin) { OSL_ENSURE( pWin, "SmEditAccessible: window missing" ); @@ -1609,7 +1609,11 @@ SmEditAccessible::SmEditAccessible( SmEditWindow *pEditWin ) : SmEditAccessible::~SmEditAccessible() { - delete pTextHelper; +} + +::accessibility::AccessibleTextHelper *SmEditAccessible::GetTextHelper() +{ + return pTextHelper.get(); } void SmEditAccessible::Init() @@ -1623,7 +1627,8 @@ void SmEditAccessible::Init() { ::std::unique_ptr< SvxEditSource > pEditSource( new SmEditSource( pWin, *this ) ); - pTextHelper = new ::accessibility::AccessibleTextHelper( std::move(pEditSource) ); + assert(!pTextHelper); + pTextHelper.reset(new ::accessibility::AccessibleTextHelper( std::move(pEditSource) )); pTextHelper->SetEventSource( this ); } } @@ -1644,7 +1649,7 @@ void SmEditAccessible::ClearWin() //! make TextHelper release references //! (e.g. the one set by the 'SetEventSource' call) pTextHelper->Dispose(); - delete pTextHelper; pTextHelper = nullptr; + pTextHelper.reset(); } // XAccessible diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx index c4cd3c32177b..953e44790e50 100644 --- a/starmath/source/accessibility.hxx +++ b/starmath/source/accessibility.hxx @@ -37,6 +37,7 @@ #include <editeng/unoedsrc.hxx> #include <svx/AccessibleTextHelper.hxx> #include <edit.hxx> +#include <memory> class SmGraphicWindow; class SmEditWindow; @@ -314,7 +315,7 @@ class SmEditAccessible : public SmEditAccessibleBaseClass { OUString aAccName; - ::accessibility::AccessibleTextHelper *pTextHelper; + std::unique_ptr<::accessibility::AccessibleTextHelper> pTextHelper; VclPtr<SmEditWindow> pWin; SmEditAccessible( const SmEditAccessible & ) = delete; @@ -324,7 +325,7 @@ public: explicit SmEditAccessible( SmEditWindow *pEditWin ); virtual ~SmEditAccessible(); - ::accessibility::AccessibleTextHelper * GetTextHelper() { return pTextHelper; } + ::accessibility::AccessibleTextHelper * GetTextHelper(); void Init(); void ClearWin(); // to be called when view is destroyed |