summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorPranav Kant <pranav913@gmail.com>2015-03-17 12:56:54 +0530
committerStephan Bergmann <sbergman@redhat.com>2015-03-20 12:18:02 +0000
commit33de587e95dddfc8e3c89b84f90b3d1bca823dae (patch)
treec65ada218c27ae4f2e80b4e3476b67c8e4554ef8 /vcl/source
parent9e2e9453cbca9399e1c670b354cfc3c23d70307f (diff)
tdf#88230: cleanup solar mutex yielding
Use SolarMutexReleaser, instead. Change-Id: I276459c42b688813ea168d6fc80466a07a5ecba4 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/app/session.cxx13
-rw-r--r--vcl/source/app/svmain.cxx10
-rw-r--r--vcl/source/app/unohelp2.cxx3
-rw-r--r--vcl/source/control/edit.cxx24
-rw-r--r--vcl/source/edit/textview.cxx19
-rw-r--r--vcl/source/helper/threadex.cxx4
-rw-r--r--vcl/source/window/winproc.cxx4
7 files changed, 31 insertions, 46 deletions
diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx
index 294a58172689..5db137f4d463 100644
--- a/vcl/source/app/session.cxx
+++ b/vcl/source/app/session.cxx
@@ -134,10 +134,9 @@ void VCLSession::callSaveRequested( bool bShutdown, bool bCancelable )
}
}
- sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
+ SolarMutexReleaser aReleaser;
for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it )
it->m_xListener->doSave( bShutdown, bCancelable );
- Application::AcquireSolarMutex( nAcquireCount );
}
void VCLSession::callInteractionGranted( bool bInteractionGranted )
@@ -162,11 +161,9 @@ void VCLSession::callInteractionGranted( bool bInteractionGranted )
}
}
- sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
+ SolarMutexReleaser aReleaser;
for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it )
it->m_xListener->approveInteraction( bInteractionGranted );
-
- Application::AcquireSolarMutex( nAcquireCount );
}
void VCLSession::callShutdownCancelled()
@@ -180,10 +177,9 @@ void VCLSession::callShutdownCancelled()
m_bInteractionRequested = m_bInteractionDone = m_bInteractionGranted = false;
}
- sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
+ SolarMutexReleaser aReleaser;
for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it )
it->m_xListener->shutdownCanceled();
- Application::AcquireSolarMutex( nAcquireCount );
}
void VCLSession::callQuit()
@@ -197,14 +193,13 @@ void VCLSession::callQuit()
m_bInteractionRequested = m_bInteractionDone = m_bInteractionGranted = false;
}
- sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
+ SolarMutexReleaser aReleaser;
for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it )
{
css::uno::Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY );
if( xListener2.is() )
xListener2->doQuit();
}
- Application::AcquireSolarMutex( nAcquireCount );
}
void VCLSession::SalSessionEventProc( void* pData, SalSessionEvent* pEvent )
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 9d59eac6ec5b..1f597e5eb404 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -176,9 +176,10 @@ int ImplSVMain()
// here ..
if( pSVData->mxAccessBridge.is() )
{
- sal_uLong nCount = Application::ReleaseSolarMutex();
- pSVData->mxAccessBridge->dispose();
- Application::AcquireSolarMutex(nCount);
+ {
+ SolarMutexReleaser aReleaser;
+ pSVData->mxAccessBridge->dispose();
+ }
pSVData->mxAccessBridge.clear();
}
@@ -472,7 +473,7 @@ void DeInitVCL()
if( pSVData->mpApp || pSVData->maDeInitHook.IsSet() )
{
- sal_uLong nCount = Application::ReleaseSolarMutex();
+ SolarMutexReleaser aReleaser;
// call deinit to deinitialize application class
// soffice/sfx implementation disposes the global service manager
// Warning: After this call you can't call uno services
@@ -484,7 +485,6 @@ void DeInitVCL()
{
pSVData->maDeInitHook.Call(0);
}
- Application::AcquireSolarMutex(nCount);
}
if ( pSVData->maAppData.mpSettings )
diff --git a/vcl/source/app/unohelp2.cxx b/vcl/source/app/unohelp2.cxx
index 2f2e3d66124f..280f04eeadeb 100644
--- a/vcl/source/app/unohelp2.cxx
+++ b/vcl/source/app/unohelp2.cxx
@@ -47,7 +47,7 @@ namespace vcl { namespace unohelper {
TextDataObject* pDataObj = new TextDataObject( rContent );
- const sal_uInt32 nRef = Application::ReleaseSolarMutex();
+ SolarMutexReleaser aReleaser;
try
{
rxClipboard->setContents( pDataObj, NULL );
@@ -59,7 +59,6 @@ namespace vcl { namespace unohelper {
catch( const uno::Exception& )
{
}
- Application::AcquireSolarMutex( nRef );
}
// ::com::sun::star::uno::XInterface
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index fb6dde7d307d..f704e66d458b 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1285,17 +1285,14 @@ void Edit::ImplPaste( uno::Reference< datatransfer::clipboard::XClipboard >& rxC
{
uno::Reference< datatransfer::XTransferable > xDataObj;
- const sal_uInt32 nRef = Application::ReleaseSolarMutex();
-
try
- {
- xDataObj = rxClipboard->getContents();
- }
+ {
+ SolarMutexReleaser aReleaser;
+ xDataObj = rxClipboard->getContents();
+ }
catch( const ::com::sun::star::uno::Exception& )
- {
- }
-
- Application::AcquireSolarMutex( nRef );
+ {
+ }
if ( xDataObj.is() )
{
@@ -1983,11 +1980,14 @@ void Edit::Command( const CommandEvent& rCEvt )
// only paste if text available in clipboard
bool bData = false;
uno::Reference< datatransfer::clipboard::XClipboard > xClipboard = GetClipboard();
+
if ( xClipboard.is() )
{
- const sal_uInt32 nRef = Application::ReleaseSolarMutex();
- uno::Reference< datatransfer::XTransferable > xDataObj = xClipboard->getContents();
- Application::AcquireSolarMutex( nRef );
+ uno::Reference< datatransfer::XTransferable > xDataObj;
+ {
+ SolarMutexReleaser aReleaser;
+ xDataObj = xClipboard->getContents();
+ }
if ( xDataObj.is() )
{
datatransfer::DataFlavor aFlavor;
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 030365f4ddbb..cafbbf52f9c4 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -1132,7 +1132,7 @@ void TextView::Copy( uno::Reference< datatransfer::clipboard::XClipboard >& rxCl
if ( mpImpl->mpTextEngine->HasAttrib( TEXTATTR_HYPERLINK ) ) // then also as HTML
mpImpl->mpTextEngine->Write( pDataObj->GetHTMLStream(), &mpImpl->maSelection, true );
- const sal_uInt32 nRef = Application::ReleaseSolarMutex();
+ SolarMutexReleaser aReleaser;
try
{
@@ -1145,8 +1145,6 @@ void TextView::Copy( uno::Reference< datatransfer::clipboard::XClipboard >& rxCl
catch( const ::com::sun::star::uno::Exception& )
{
}
-
- Application::AcquireSolarMutex( nRef );
}
}
@@ -1162,17 +1160,14 @@ void TextView::Paste( uno::Reference< datatransfer::clipboard::XClipboard >& rxC
{
uno::Reference< datatransfer::XTransferable > xDataObj;
- const sal_uInt32 nRef = Application::ReleaseSolarMutex();
-
try
- {
- xDataObj = rxClipboard->getContents();
- }
+ {
+ SolarMutexReleaser aReleaser;
+ xDataObj = rxClipboard->getContents();
+ }
catch( const ::com::sun::star::uno::Exception& )
- {
- }
-
- Application::AcquireSolarMutex( nRef );
+ {
+ }
if ( xDataObj.is() )
{
diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx
index 37d8ef892a9b..a62bcfc3ab88 100644
--- a/vcl/source/helper/threadex.cxx
+++ b/vcl/source/helper/threadex.cxx
@@ -59,7 +59,7 @@ long SolarThreadExecutor::impl_execute( const TimeValue* _pTimeout )
{
osl_resetCondition( m_aStart );
osl_resetCondition( m_aFinish );
- sal_uLong nSolarMutexCount = Application::ReleaseSolarMutex();
+ SolarMutexReleaser aReleaser;
ImplSVEvent * nEvent = Application::PostUserEvent( LINK( this, SolarThreadExecutor, worker ) );
if ( osl_cond_result_timeout == osl_waitCondition( m_aStart, _pTimeout ) )
{
@@ -68,8 +68,6 @@ long SolarThreadExecutor::impl_execute( const TimeValue* _pTimeout )
}
else
osl_waitCondition( m_aFinish, NULL );
- if( nSolarMutexCount )
- Application::AcquireSolarMutex( nSolarMutexCount );
}
return m_nReturn;
}
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index c9db00486637..537bac3f249d 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -510,7 +510,7 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, bool
nClicks,
false );
- sal_uLong nCount = Application::ReleaseSolarMutex();
+ SolarMutexReleaser aReleaser;
// FIXME: where do I get Action from ?
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > xDragSource = pMouseDownWin->GetDragSource();
@@ -520,8 +520,6 @@ bool ImplHandleMouseEvent( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, bool
static_cast < DNDListenerContainer * > ( xDragGestureRecognizer.get() )->fireDragGestureEvent( 0,
relLoc.X(), relLoc.Y(), xDragSource, ::com::sun::star::uno::makeAny( aMouseEvent ) );
}
-
- Application::AcquireSolarMutex( nCount );
}
}
}