diff options
author | Frank Schönheit <fs@openoffice.org> | 2002-01-08 13:19:57 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2002-01-08 13:19:57 +0000 |
commit | 04625cea3877954692ade3bdaddbf3fd2ecf6048 (patch) | |
tree | eb1d1142afb68b8430ca11a32acf84475731cf6b /basic/source/runtime/runtime.cxx | |
parent | 31cb31335f3bf7e6e57d70ca61bf5a2a536d1e6e (diff) |
#96008# SbiInstance::~SbiInstance: dispose not the controls, but the control models
Diffstat (limited to 'basic/source/runtime/runtime.cxx')
-rw-r--r-- | basic/source/runtime/runtime.cxx | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index d937ebbe9c73..7b691ebd324a 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -2,9 +2,9 @@ * * $RCSfile: runtime.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: ab $ $Date: 2001-11-26 16:34:28 $ + * last change: $Author: fs $ $Date: 2002-01-08 14:19:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,9 @@ #ifndef _COMPHELPER_PROCESSFACTORY_HXX_ #include <comphelper/processfactory.hxx> #endif +#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_ +#include <com/sun/star/awt/XControl.hpp> +#endif // Makro MEMBER() #include <macfix.hxx> @@ -311,15 +314,39 @@ SbiInstance::~SbiInstance() delete pDllMgr; delete pNumberFormatter; - // Dispose components, especially dialogs created in CreateUnoDialog - ComponentVector_t::const_iterator iPos( ComponentVector.begin() ); - while( iPos != ComponentVector.end() ) + try + { + // Dispose components, especially dialogs created in CreateUnoDialog + ComponentVector_t::const_iterator iPos( ComponentVector.begin() ); + while( iPos != ComponentVector.end() ) + { + if ( iPos->is() ) + { + Reference< XComponent > xDisposeMe; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xDialogComponent( *iPos, ::com::sun::star::uno::UNO_QUERY ); + if ( xDialogComponent.is() ) + xDisposeMe = xDisposeMe.query( xDialogComponent->getModel() ); + + if ( !xDisposeMe.is() ) + { + DBG_ERROR( "SbiInstance::~SbiInstance: not a valid control component!" ); + // at the moment, there are only XControl's stored in the component vector. + // If this changes some time in the future, this assertion has to be removed + xDisposeMe = *iPos; + } + + xDisposeMe->dispose(); + } + + ++iPos; + } + } + catch( const Exception& ) { - Reference< XComponent > xDlgComponent = *iPos ; - if( xDlgComponent.is() ) - xDlgComponent->dispose(); - ++iPos; + DBG_ERROR( "SbiInstance::~SbiInstance: caught an exception while disposing the components!" ); } + ComponentVector.clear(); } |