diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-03-10 15:34:06 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-03-10 15:34:32 +0100 |
commit | 3b0fda641467cc99ef86eb538de02b7bfda8fae0 (patch) | |
tree | fbdb184709bf58b17575c829f8591ba73c80b138 /desktop | |
parent | 9daa9799acbd3ca74c1932cff35c5cf71b26d7ea (diff) |
mpDispatchWatcher is a natural place to hold the DispatchWatcher singleton
Change-Id: I6221023f0158388b05db045453111974c5cb0458
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/dispatchwatcher.cxx | 20 | ||||
-rw-r--r-- | desktop/source/app/dispatchwatcher.hxx | 7 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 2 |
3 files changed, 3 insertions, 26 deletions
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 5950097d084c..49dce8122441 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -180,26 +180,6 @@ Mutex& DispatchWatcher::GetMutex() return theWatcherMutex::get(); } -// Create or get the dispatch watcher implementation. This implementation must be -// a singleton to prevent access to the framework after it wants to terminate. -rtl::Reference<DispatchWatcher> DispatchWatcher::GetDispatchWatcher() -{ - static rtl::Reference<DispatchWatcher> xDispatchWatcher; - - if ( !xDispatchWatcher.is() ) - { - ::osl::MutexGuard aGuard( GetMutex() ); - - if ( !xDispatchWatcher.is() ) - { - xDispatchWatcher = new DispatchWatcher(); - } - } - - return xDispatchWatcher; -} - - DispatchWatcher::DispatchWatcher() : m_nRequestCount(0) { diff --git a/desktop/source/app/dispatchwatcher.hxx b/desktop/source/app/dispatchwatcher.hxx index aa4437801b90..13c5b253ffd9 100644 --- a/desktop/source/app/dispatchwatcher.hxx +++ b/desktop/source/app/dispatchwatcher.hxx @@ -70,6 +70,8 @@ class DispatchWatcher : public ::cppu::WeakImplHelper< css::frame::XDispatchResu typedef std::vector< DispatchRequest > DispatchList; + DispatchWatcher(); + virtual ~DispatchWatcher(); // XEventListener @@ -79,15 +81,10 @@ class DispatchWatcher : public ::cppu::WeakImplHelper< css::frame::XDispatchResu // XDispachResultListener virtual void SAL_CALL dispatchFinished( const css::frame::DispatchResultEvent& aEvent ) throw( css::uno::RuntimeException, std::exception ) override; - // Access function to get a dispatcher watcher reference. There must be a global reference holder - static rtl::Reference<DispatchWatcher> GetDispatchWatcher(); - // execute new dispatch request bool executeDispatchRequests( const DispatchList& aDispatches, bool bNoTerminate = false ); private: - DispatchWatcher(); - static ::osl::Mutex& GetMutex(); std::unordered_map<OUString, sal_Int32, OUStringHash> diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index b0073a359948..7d1ebf423703 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -1079,7 +1079,7 @@ bool OfficeIPCThread::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequest pGlobalOfficeIPCThread->mnPendingRequests += aDispatchList.size(); if ( !pGlobalOfficeIPCThread->mpDispatchWatcher.is() ) { - pGlobalOfficeIPCThread->mpDispatchWatcher = DispatchWatcher::GetDispatchWatcher(); + pGlobalOfficeIPCThread->mpDispatchWatcher = new DispatchWatcher; } // copy for execute |