From 5800a27b9c4bb6d3c766d4f2e3960b42cabdc6df Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Thu, 26 Feb 2015 17:10:15 +0000 Subject: dbaccess: protection against double disposes. Change-Id: I4ce2d00248b3d3d8370cc58155ea0607d4de482b --- svtools/source/contnr/treelistbox.cxx | 52 ++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 19 deletions(-) (limited to 'svtools') diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index b50e746081ac..37e08bb37a1a 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -1546,29 +1546,43 @@ SvTreeListBox::~SvTreeListBox() void SvTreeListBox::dispose() { - - pImp->CallEventListeners( VCLEVENT_OBJECT_DYING ); - delete pImp; - delete mpImpl->m_pLink; - ClearTabList(); - - delete pEdCtrl; - pEdCtrl = 0; - pModel->RemoveView( this ); - if ( pModel->GetRefCount() == 0 ) + if( pImp ) { - pModel->Clear(); - delete pModel; - pModel = NULL; + pImp->CallEventListeners( VCLEVENT_OBJECT_DYING ); + delete pImp; + pImp = NULL; } + if( mpImpl ) + { + delete mpImpl->m_pLink; + mpImpl->m_pLink = NULL; + + ClearTabList(); + + delete pEdCtrl; + pEdCtrl = NULL; + + if( pModel ) + { + pModel->RemoveView( this ); + if ( pModel->GetRefCount() == 0 ) + { + pModel->Clear(); + delete pModel; + pModel = NULL; + } + } - SvTreeListBox::RemoveBoxFromDDList_Impl( *this ); + SvTreeListBox::RemoveBoxFromDDList_Impl( *this ); + + if( this == pDDSource ) + pDDSource = 0; + if( this == pDDTarget ) + pDDTarget = 0; + delete mpImpl; + mpImpl = NULL; + } - if( this == pDDSource ) - pDDSource = 0; - if( this == pDDTarget ) - pDDTarget = 0; - delete mpImpl; Control::dispose(); } -- cgit