From ba203843f5a209cb48e2d6f4ec4e3649982185ea Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Sat, 23 May 2015 19:59:55 +0100 Subject: tdf#91499 - cleanup AnyRefDialog VclPtr's with an explicit dispose method. Change-Id: Ib3571fc6d2aa9343bcfd2d6a5bdbd6b1d193c0f1 Reviewed-on: https://gerrit.libreoffice.org/15883 Tested-by: Jenkins Reviewed-by: Michael Meeks Tested-by: Michael Meeks --- sc/source/ui/inc/anyrefdg.hxx | 10 +++++++++- sc/source/ui/miscdlgs/anyrefdg.cxx | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'sc') diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index 5bcc688a96d4..5f717ffd6a67 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -127,6 +127,7 @@ private: DECL_LINK_TYPED( UpdateFocusHdl, Idle*, void ); protected: + void disposeRefHandler(); bool DoClose( sal_uInt16 nId ); static void SetDispatcherLock( bool bLock ); @@ -280,9 +281,16 @@ struct ScRefHdlrImpl: ScRefHdlrImplBase< TBase, bBindRef > SC_MOD()->RegisterRefWindow( static_cast( static_cast(this)->SLOTID ), this ); } - ~ScRefHdlrImpl() + virtual void dispose() SAL_OVERRIDE { SC_MOD()->UnregisterRefWindow( static_cast( static_cast(this)->SLOTID ), this ); + ScRefHdlrImplBase::disposeRefHandler(); + TBase::dispose(); + } + + ~ScRefHdlrImpl() + { + dispose(); } }; diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 5219f96f33f9..aab5194546b7 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -823,6 +823,13 @@ bool ScRefHandler::EnterRefMode() ScRefHandler::~ScRefHandler() { + disposeRefHandler(); +} + +void ScRefHandler::disposeRefHandler() +{ + m_rWindow.clear(); + pActiveWin.clear(); LeaveRefMode(); } -- cgit v1.2.3