summaryrefslogtreecommitdiff
path: root/comphelper/source/misc/instancelocker.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'comphelper/source/misc/instancelocker.cxx')
-rw-r--r--comphelper/source/misc/instancelocker.cxx166
1 files changed, 83 insertions, 83 deletions
diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx
index ad581840d01d..c32747e26514 100644
--- a/comphelper/source/misc/instancelocker.cxx
+++ b/comphelper/source/misc/instancelocker.cxx
@@ -256,19 +256,19 @@ void SAL_CALL OLockListener::disposing( const lang::EventObject& aEvent )
osl::ClearableMutexGuard aGuard( m_aMutex );
// object is disposed
- if ( aEvent.Source == m_xInstance )
- {
- // the object does not listen for anything any more
- m_nMode = 0;
+ if ( aEvent.Source != m_xInstance )
+ return;
- // dispose the wrapper;
- uno::Reference< lang::XComponent > xComponent( m_xWrapper.get(), uno::UNO_QUERY );
- aGuard.clear();
- if ( xComponent.is() )
- {
- try { xComponent->dispose(); }
- catch( uno::Exception& ){}
- }
+ // the object does not listen for anything any more
+ m_nMode = 0;
+
+ // dispose the wrapper;
+ uno::Reference< lang::XComponent > xComponent( m_xWrapper.get(), uno::UNO_QUERY );
+ aGuard.clear();
+ if ( xComponent.is() )
+ {
+ try { xComponent->dispose(); }
+ catch( uno::Exception& ){}
}
}
@@ -279,27 +279,27 @@ void SAL_CALL OLockListener::queryClosing( const lang::EventObject& aEvent, sal_
{
// GetsOwnership parameter is always ignored, the user of the service must close the object always
osl::ClearableMutexGuard aGuard( m_aMutex );
- if ( !m_bDisposed && aEvent.Source == m_xInstance && ( m_nMode & embed::Actions::PREVENT_CLOSE ) )
+ if ( !(!m_bDisposed && aEvent.Source == m_xInstance && ( m_nMode & embed::Actions::PREVENT_CLOSE )) )
+ return;
+
+ try
{
- try
- {
- uno::Reference< embed::XActionsApproval > xApprove = m_xApproval;
+ uno::Reference< embed::XActionsApproval > xApprove = m_xApproval;
- // unlock the mutex here
- aGuard.clear();
+ // unlock the mutex here
+ aGuard.clear();
- if ( xApprove.is() && xApprove->approveAction( embed::Actions::PREVENT_CLOSE ) )
- throw util::CloseVetoException();
- }
- catch( util::CloseVetoException& )
- {
- // rethrow this exception
- throw;
- }
- catch( uno::Exception& )
- {
- // no action should be done
- }
+ if ( xApprove.is() && xApprove->approveAction( embed::Actions::PREVENT_CLOSE ) )
+ throw util::CloseVetoException();
+ }
+ catch( util::CloseVetoException& )
+ {
+ // rethrow this exception
+ throw;
+ }
+ catch( uno::Exception& )
+ {
+ // no action should be done
}
}
@@ -309,24 +309,24 @@ void SAL_CALL OLockListener::notifyClosing( const lang::EventObject& aEvent )
osl::ClearableMutexGuard aGuard( m_aMutex );
// object is closed, no reason to listen
- if ( aEvent.Source == m_xInstance )
+ if ( aEvent.Source != m_xInstance )
+ return;
+
+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( aEvent.Source, uno::UNO_QUERY );
+ if ( !xCloseBroadcaster.is() )
+ return;
+
+ xCloseBroadcaster->removeCloseListener( static_cast< util::XCloseListener* >( this ) );
+ m_nMode &= ~embed::Actions::PREVENT_CLOSE;
+ if ( !m_nMode )
{
- uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( aEvent.Source, uno::UNO_QUERY );
- if ( xCloseBroadcaster.is() )
+ // dispose the wrapper;
+ uno::Reference< lang::XComponent > xComponent( m_xWrapper.get(), uno::UNO_QUERY );
+ aGuard.clear();
+ if ( xComponent.is() )
{
- xCloseBroadcaster->removeCloseListener( static_cast< util::XCloseListener* >( this ) );
- m_nMode &= ~embed::Actions::PREVENT_CLOSE;
- if ( !m_nMode )
- {
- // dispose the wrapper;
- uno::Reference< lang::XComponent > xComponent( m_xWrapper.get(), uno::UNO_QUERY );
- aGuard.clear();
- if ( xComponent.is() )
- {
- try { xComponent->dispose(); }
- catch( uno::Exception& ){}
- }
- }
+ try { xComponent->dispose(); }
+ catch( uno::Exception& ){}
}
}
}
@@ -337,27 +337,27 @@ void SAL_CALL OLockListener::notifyClosing( const lang::EventObject& aEvent )
void SAL_CALL OLockListener::queryTermination( const lang::EventObject& aEvent )
{
osl::ClearableMutexGuard aGuard( m_aMutex );
- if ( aEvent.Source == m_xInstance && ( m_nMode & embed::Actions::PREVENT_TERMINATION ) )
+ if ( !(aEvent.Source == m_xInstance && ( m_nMode & embed::Actions::PREVENT_TERMINATION )) )
+ return;
+
+ try
{
- try
- {
- uno::Reference< embed::XActionsApproval > xApprove = m_xApproval;
+ uno::Reference< embed::XActionsApproval > xApprove = m_xApproval;
- // unlock the mutex here
- aGuard.clear();
+ // unlock the mutex here
+ aGuard.clear();
- if ( xApprove.is() && xApprove->approveAction( embed::Actions::PREVENT_TERMINATION ) )
- throw frame::TerminationVetoException();
- }
- catch( frame::TerminationVetoException& )
- {
- // rethrow this exception
- throw;
- }
- catch( uno::Exception& )
- {
- // no action should be done
- }
+ if ( xApprove.is() && xApprove->approveAction( embed::Actions::PREVENT_TERMINATION ) )
+ throw frame::TerminationVetoException();
+ }
+ catch( frame::TerminationVetoException& )
+ {
+ // rethrow this exception
+ throw;
+ }
+ catch( uno::Exception& )
+ {
+ // no action should be done
}
}
@@ -367,31 +367,31 @@ void SAL_CALL OLockListener::notifyTermination( const lang::EventObject& aEvent
osl::ClearableMutexGuard aGuard( m_aMutex );
// object is terminated, no reason to listen
- if ( aEvent.Source == m_xInstance )
+ if ( aEvent.Source != m_xInstance )
+ return;
+
+ uno::Reference< frame::XDesktop > xDesktop( aEvent.Source, uno::UNO_QUERY );
+ if ( !xDesktop.is() )
+ return;
+
+ try
{
- uno::Reference< frame::XDesktop > xDesktop( aEvent.Source, uno::UNO_QUERY );
- if ( xDesktop.is() )
+ xDesktop->removeTerminateListener( static_cast< frame::XTerminateListener* >( this ) );
+ m_nMode &= ~embed::Actions::PREVENT_TERMINATION;
+ if ( !m_nMode )
{
- try
+ // dispose the wrapper;
+ uno::Reference< lang::XComponent > xComponent( m_xWrapper.get(), uno::UNO_QUERY );
+ aGuard.clear();
+ if ( xComponent.is() )
{
- xDesktop->removeTerminateListener( static_cast< frame::XTerminateListener* >( this ) );
- m_nMode &= ~embed::Actions::PREVENT_TERMINATION;
- if ( !m_nMode )
- {
- // dispose the wrapper;
- uno::Reference< lang::XComponent > xComponent( m_xWrapper.get(), uno::UNO_QUERY );
- aGuard.clear();
- if ( xComponent.is() )
- {
- try { xComponent->dispose(); }
- catch( uno::Exception& ){}
- }
- }
+ try { xComponent->dispose(); }
+ catch( uno::Exception& ){}
}
- catch( uno::Exception& )
- {}
}
}
+ catch( uno::Exception& )
+ {}
}