summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-12-16 10:52:40 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-12-16 14:21:26 +0100
commit4ac13fb72a12ac6dba7b002a4ac0cdd40eaaada5 (patch)
treeb103d92ddb14d69f928daff332b718fba4a4195a /framework
parente9e61809ea31b30f50d39dda45e54bed6f0e4742 (diff)
No need for TransactionGuard::stop
Change-Id: If1c0b7285817bb10338077460b77de4a27d35753
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/threadhelp/transactionguard.hxx19
-rw-r--r--framework/source/services/desktop.cxx16
-rw-r--r--framework/source/services/frame.cxx115
3 files changed, 62 insertions, 88 deletions
diff --git a/framework/inc/threadhelp/transactionguard.hxx b/framework/inc/threadhelp/transactionguard.hxx
index ac3aecab2882..52ee098e0720 100644
--- a/framework/inc/threadhelp/transactionguard.hxx
+++ b/framework/inc/threadhelp/transactionguard.hxx
@@ -67,24 +67,7 @@ class TransactionGuard : private boost::noncopyable
*//*-*************************************************************************************************************/
inline ~TransactionGuard()
{
- stop();
- }
-
- /*-************************************************************************************************************
- @short stop current transaction
- @descr We must release the transaction manager and can forget his pointer.
-
- @attention We don't support any start() method here - because it is not easy to
- detect if a transaction already started or not!
- (combination of EExceptionMode and ERejectReason)
- *//*-*************************************************************************************************************/
- inline void stop()
- {
- if( m_pManager != nullptr )
- {
- m_pManager->unregisterTransaction();
- m_pManager = nullptr;
- }
+ m_pManager->unregisterTransaction();
}
private:
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 35ce361bb1de..68c5ca8954e5 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -1029,19 +1029,9 @@ void SAL_CALL Desktop::disposing()
SolarMutexClearableGuard aWriteLock;
- // Look for multiple calls of this method!
- // If somewhere call dispose() twice - he will be stopped here really!!!
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- // Now - we are alone and its the first call of this method ...
- // otherwise call before had thrown a DisposedException / hopefully .-)
- // But we don't use the transaction object created before ... we reset it immediately ...
- // two lines of code ... for what ?
- // The answer: We wished to synchronize concurrent dispose() calls -> OK
- // But next line will wait for all currently running transaction (even if they
- // are running within the same thread!) So we would block ourself there if aTransaction
- // will stay registered .-)
- aTransaction.stop();
+ {
+ TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+ }
// Disable this instance for further work.
// This will wait for all current running transactions ...
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index bcd12d4cc6bb..69692ecc66c3 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -1729,79 +1729,80 @@ void SAL_CALL Frame::removeFrameActionListener( const css::uno::Reference< css::
void SAL_CALL Frame::close( sal_Bool bDeliverOwnership ) throw( css::util::CloseVetoException,
css::uno::RuntimeException, std::exception )
{
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- // At the end of this method may we must dispose ourself...
- // and may nobody from outside hold a reference to us...
- // then it's a good idea to do that by ourself.
- css::uno::Reference< css::uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) );
-
- // Check any close listener before we look for currently running internal processes.
- // Because if a listener disagree with this close() request - we have time to finish this
- // internal operations too...
- // Note: container is threadsafe himself.
- css::lang::EventObject aSource (static_cast< ::cppu::OWeakObject*>(this));
- ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::util::XCloseListener>::get());
- if (pContainer!=nullptr)
{
- ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
- while (pIterator.hasMoreElements())
+ TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+
+ // At the end of this method may we must dispose ourself...
+ // and may nobody from outside hold a reference to us...
+ // then it's a good idea to do that by ourself.
+ css::uno::Reference< css::uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) );
+
+ // Check any close listener before we look for currently running internal processes.
+ // Because if a listener disagree with this close() request - we have time to finish this
+ // internal operations too...
+ // Note: container is threadsafe himself.
+ css::lang::EventObject aSource (static_cast< ::cppu::OWeakObject*>(this));
+ ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::util::XCloseListener>::get());
+ if (pContainer!=nullptr)
{
- try
+ ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
+ while (pIterator.hasMoreElements())
{
- static_cast<css::util::XCloseListener*>(pIterator.next())->queryClosing( aSource, bDeliverOwnership );
- }
- catch( const css::uno::RuntimeException& )
- {
- pIterator.remove();
+ try
+ {
+ static_cast<css::util::XCloseListener*>(pIterator.next())->queryClosing( aSource, bDeliverOwnership );
+ }
+ catch( const css::uno::RuntimeException& )
+ {
+ pIterator.remove();
+ }
}
}
- }
- // Ok - no listener disagreed with this close() request
- // check if this frame is used for any load process currently
- if (isActionLocked())
- {
- if (bDeliverOwnership)
+ // Ok - no listener disagreed with this close() request
+ // check if this frame is used for any load process currently
+ if (isActionLocked())
{
- SolarMutexGuard g;
- m_bSelfClose = true;
- }
+ if (bDeliverOwnership)
+ {
+ SolarMutexGuard g;
+ m_bSelfClose = true;
+ }
- throw css::util::CloseVetoException("Frame in use for loading document ...",static_cast< ::cppu::OWeakObject*>(this));
- }
+ throw css::util::CloseVetoException("Frame in use for loading document ...",static_cast< ::cppu::OWeakObject*>(this));
+ }
- if ( ! setComponent(nullptr,nullptr) )
- throw css::util::CloseVetoException("Component couldn't be deattached ...",static_cast< ::cppu::OWeakObject*>(this));
+ if ( ! setComponent(nullptr,nullptr) )
+ throw css::util::CloseVetoException("Component couldn't be deattached ...",static_cast< ::cppu::OWeakObject*>(this));
- // If closing is allowed... inform all listeners and dispose this frame!
- pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::util::XCloseListener>::get());
- if (pContainer!=nullptr)
- {
- ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
- while (pIterator.hasMoreElements())
+ // If closing is allowed... inform all listeners and dispose this frame!
+ pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::util::XCloseListener>::get());
+ if (pContainer!=nullptr)
{
- try
+ ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
+ while (pIterator.hasMoreElements())
{
- static_cast<css::util::XCloseListener*>(pIterator.next())->notifyClosing( aSource );
- }
- catch( const css::uno::RuntimeException& )
- {
- pIterator.remove();
+ try
+ {
+ static_cast<css::util::XCloseListener*>(pIterator.next())->notifyClosing( aSource );
+ }
+ catch( const css::uno::RuntimeException& )
+ {
+ pIterator.remove();
+ }
}
}
- }
- /* SAFE { */
- SolarMutexClearableGuard aWriteLock;
- m_bIsHidden = true;
- aWriteLock.clear();
- /* } SAFE */
- impl_checkMenuCloser();
+ /* SAFE { */
+ SolarMutexClearableGuard aWriteLock;
+ m_bIsHidden = true;
+ aWriteLock.clear();
+ /* } SAFE */
+ impl_checkMenuCloser();
- // Attention: We must release our own registered transaction here. Otherwhise following dispose() call
- // wait for us too ....
- aTransaction.stop();
+ // Attention: We must release our own registered transaction here. Otherwhise following dispose() call
+ // wait for us too ....
+ }
dispose();
}