diff options
author | Andreas Schlüns <as@openoffice.org> | 2001-03-05 07:09:05 +0000 |
---|---|---|
committer | Andreas Schlüns <as@openoffice.org> | 2001-03-05 07:09:05 +0000 |
commit | f3f94666b46f72928d0ef8b2883c7208f122a065 (patch) | |
tree | 7d4c98885436a5964ccf50be21f5451ed2fe6055 /framework | |
parent | 74b43fe0393bd8c2c6b5c3753cfe681cbc9d25f2 (diff) |
#84389# dipose desktop helper
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/services/desktop.hxx | 5 | ||||
-rw-r--r-- | framework/source/services/desktop.cxx | 66 |
2 files changed, 40 insertions, 31 deletions
diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx index 9fe16f691894..edbf86b5d8d6 100644 --- a/framework/inc/services/desktop.hxx +++ b/framework/inc/services/desktop.hxx @@ -2,9 +2,9 @@ * * $RCSfile: desktop.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: as $ $Date: 2001-01-26 08:39:19 $ + * last change: $Author: as $ $Date: 2001-03-05 08:09:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1336,6 +1336,7 @@ class Desktop : public XTYPEPROVIDER , eIMPL_loadState m_eLoadState ; /// hold information about state of asynchron loading of component for loadComponentFromURL()! TaskCreator m_aTaskCreator ; /// Helper to create new tasks or plugin frames! REFERENCE< XFRAME > m_xLastFrame ; + sal_Bool m_bAlreadyDisposed ; /// protection against multiple dispose calls // Properties //OLD REFERENCE< XCOMPONENT > m_xActiveComponent ; Durch setActive/getActive am Container zu ersetzen! (+cast nach XComponent!) diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index d101bf09af9f..6ea8c742b88e 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -2,9 +2,9 @@ * * $RCSfile: desktop.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: mba $ $Date: 2001-02-14 13:22:23 $ + * last change: $Author: as $ $Date: 2001-03-05 08:09:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -266,6 +266,7 @@ Desktop::Desktop( const Reference< XMultiServiceFactory >& xFactory ) , m_bHasStatusBar ( sal_True ) , m_bHasToolbar ( sal_True ) , m_aISOLocale ( ) + , m_bAlreadyDisposed ( sal_False ) #ifdef ENABLE_ASSERTIONS , m_bIsTerminated ( sal_False ) // see dispose() for further informations! #endif @@ -311,8 +312,8 @@ Desktop::Desktop( const Reference< XMultiServiceFactory >& xFactory ) //***************************************************************************************************************** Desktop::~Desktop() { - // Reset instance, free memory .... - impl_resetObject(); + LOG_ASSERT( !(m_bAlreadyDisposed==sal_False), "Desktop::~Desktop()\nYou forgot to dispose the desktop!\n" ) + LOG_ASSERT( !(m_bIsTerminated ==sal_False), "Desktop::~Desktop()\nYou forgot to terminate the desktop!\n" ) } //***************************************************************************************************************** @@ -1308,31 +1309,38 @@ void SAL_CALL Desktop::dispose() throw( RuntimeException ) // It's an programming error if dispose is called before terminate! LOG_ASSERT( !(m_bIsTerminated==sal_False), "Desktop::dispose()\nIt's not allowed to dispose the desktop before terminate() is called!\n" ) - // Release all used references, delete all listener - // and free our child task container. - - /* Attention 1: - We must disable the special quit timer of our frame container. - Because it will call terminate at THESE instance (last task is removed!) ... - */ - m_aChildTaskContainer.disableQuitTimer(); - - /* Attention 2: - We must send the dispose message to all listener BEFORE we clear our container. - Otherwise our child tasks are disposed and try to remove it by himself at our container ... - Next call remove all frames which components are dispose listener at these desktop; - and then we clear all other frames from the container which are not listener! - */ - EventObject aDisposeEvent( (OWeakObject*)this ); - m_aListenerContainer.disposeAndClear( aDisposeEvent ); - - m_aChildTaskContainer.clear(); - - // Release some other references. - m_xLastFrame = Reference< XFrame >(); - m_xFactory = Reference< XMultiServiceFactory >(); - m_xFramesHelper = Reference< XFrames >(); - m_xDispatchHelper = Reference< XDispatch >(); + LOG_ASSERT( !(m_bAlreadyDisposed==sal_True), "Desktop::dispose()\nDont call dispose more then ones!\n" ) + if( m_bAlreadyDisposed == sal_False ) + { + m_bAlreadyDisposed = sal_True ; + + // Release all used references, delete all listener + // and free our child task container. + + /* Attention 1: + We must disable the special quit timer of our frame container. + Because it will call terminate at THESE instance (last task is removed!) ... + */ + m_aChildTaskContainer.disableQuitTimer(); + + /* Attention 2: + We must send the dispose message to all listener BEFORE we clear our container. + Otherwise our child tasks are disposed and try to remove it by himself at our container ... + Next call remove all frames which components are dispose listener at these desktop; + and then we clear all other frames from the container which are not listener! + */ + EventObject aDisposeEvent( (OWeakObject*)this ); + m_aListenerContainer.disposeAndClear( aDisposeEvent ); + Reference< XEventListener >( m_xDispatchHelper, UNO_QUERY )->disposing( aDisposeEvent ); + + m_aChildTaskContainer.clear(); + + // Release some other references. + m_xLastFrame = Reference< XFrame >(); + m_xFactory = Reference< XMultiServiceFactory >(); + m_xFramesHelper = Reference< XFrames >(); + m_xDispatchHelper = Reference< XDispatch >(); + } } //***************************************************************************************************************** |