starmath/source/accessibility.cxx | 13 +++++++++---- starmath/source/accessibility.hxx | 5 +++-- 2 files changed, 12 insertions(+), 6 deletions(-)
New commits: commit 8d94017289885efe6c128849e0739b81173289db Author: Takeshi Abe <t...@fixedpoint.jp> Date: Mon Dec 21 18:17:36 2015 +0900 starmath: Manage SmEditAccessible's pTextHelper via std::unique_ptr Change-Id: Iefd4314823efec28a8497b5a993fdd01ed12811e Reviewed-on: https://gerrit.libreoffice.org/20849 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Kohei Yoshida <libreoff...@kohei.us> diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx index 2e81b18..d5e8217 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 c4cd3c3..953e447 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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits