[Libreoffice-commits] core.git: 2 commits - desktop/source
Stephan Bergmann
sbergman at redhat.com
Thu Mar 10 14:34:54 UTC 2016
desktop/source/app/dispatchwatcher.cxx | 22 +---------------------
desktop/source/app/dispatchwatcher.hxx | 7 ++-----
desktop/source/app/officeipcthread.cxx | 2 +-
3 files changed, 4 insertions(+), 27 deletions(-)
New commits:
commit 3b0fda641467cc99ef86eb538de02b7bfda8fae0
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Mar 10 15:34:06 2016 +0100
mpDispatchWatcher is a natural place to hold the DispatchWatcher singleton
Change-Id: I6221023f0158388b05db045453111974c5cb0458
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index 5950097..49dce81 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 aa44378..13c5b25 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 b0073a3..7d1ebf4 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
commit 9daa9799acbd3ca74c1932cff35c5cf71b26d7ea
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Mar 10 15:15:05 2016 +0100
Just use "this"
Change-Id: If9921d73188e95395b81eb2341487423df7bc750
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index 9cdbf66..5950097 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -374,7 +374,7 @@ bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatchRequ
aArgs2[0].Value <<= sal_True;
Reference < XNotifyingDispatch > xDisp( xDispatcher, UNO_QUERY );
if ( xDisp.is() )
- xDisp->dispatchWithNotification( aURL, aArgs2, DispatchWatcher::GetDispatchWatcher().get() );
+ xDisp->dispatchWithNotification( aURL, aArgs2, this );
else
xDispatcher->dispatch( aURL, aArgs2 );
}
More information about the Libreoffice-commits
mailing list