summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2005-03-10 16:16:54 +0000
committerVladimir Glazounov <vg@openoffice.org>2005-03-10 16:16:54 +0000
commitc94ad0630f57ad4f922dc86d2263d3965f643e23 (patch)
tree19f80d6258872c4b3fca59ab2382f6ac338aaadf /desktop
parentfaf02a325a1fffd22b91d44e9eafd616a8c9c829 (diff)
INTEGRATION: CWS dba24 (1.20.18); FILE MERGED
2005/03/08 10:55:13 oj 1.20.18.2: RESYNC: (1.20-1.21); FILE MERGED 2005/03/03 15:08:53 cd 1.20.18.1: #119494# Keep reference alive when calling GetDispatchWatcher
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/dispatchwatcher.cxx19
1 files changed, 13 insertions, 6 deletions
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index cb9dfd845bfc..b0cc2f93eb9e 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dispatchwatcher.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: vg $ $Date: 2005-02-21 17:13:56 $
+ * last change: $Author: vg $ $Date: 2005-03-10 17:16:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -160,17 +160,24 @@ Mutex& DispatchWatcher::GetMutex()
return *pWatcherMutex;
}
-// Create or get the dispatch watcher implementation
+// Create or get the dispatch watcher implementation. This implementation must be
+// a singleton to prevent access to the framework after it wants to terminate.
DispatchWatcher* DispatchWatcher::GetDispatchWatcher()
{
- static DispatchWatcher* pDispatchWatcher = NULL;
+ static Reference< XInterface > xDispatchWatcher;
+ static DispatchWatcher* pDispatchWatcher = NULL;
- if ( !pDispatchWatcher )
+ if ( !xDispatchWatcher.is() )
{
::osl::MutexGuard aGuard( GetMutex() );
- if ( !pDispatchWatcher )
+ if ( !xDispatchWatcher.is() )
+ {
pDispatchWatcher = new DispatchWatcher();
+
+ // We have to hold a reference to ourself forever to prevent our own destruction.
+ xDispatchWatcher = static_cast< cppu::OWeakObject *>( pDispatchWatcher );
+ }
}
return pDispatchWatcher;