tdf#88230: cleanup solar mutex yielding

Use SolarMutexReleaser, instead.

Change-Id: I276459c42b688813ea168d6fc80466a07a5ecba4
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Pranav Kant 2015-03-17 12:56:54 +05:30 committed by Stephan Bergmann
parent 9e2e9453cb
commit 33de587e95
29 changed files with 136 additions and 181 deletions

View File

@ -513,9 +513,11 @@ sal_Bool VCLXAccessibleEdit::pasteText( sal_Int32 nIndex ) throw (IndexOutOfBoun
Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard();
if ( xClipboard.is() )
{
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
Reference< datatransfer::XTransferable > xDataObj = xClipboard->getContents();
Application::AcquireSolarMutex( nRef );
Reference< datatransfer::XTransferable > xDataObj;
{
SolarMutexReleaser aReleaser;
xDataObj = xClipboard->getContents();
}
if ( xDataObj.is() )
{
datatransfer::DataFlavor aFlavor;

View File

@ -577,12 +577,11 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( sal_Int32 nStartIndex, sal_I
OUString sText( getTextRange( nStartIndex, nEndIndex ) );
::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, NULL );
Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
if( xFlushableClipboard.is() )
xFlushableClipboard->flushClipboard();
Application::AcquireSolarMutex( nRef );
bRet = true;
}

View File

@ -404,15 +404,13 @@ sal_Bool VCLXAccessibleMenuItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEnd
OUString sText( getTextRange( nStartIndex, nEndIndex ) );
::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
xClipboard->setContents( pDataObj, NULL );
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, NULL );
Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
if( xFlushableClipboard.is() )
xFlushableClipboard->flushClipboard();
Application::AcquireSolarMutex( nRef );
bReturn = true;
}
}

View File

@ -592,15 +592,14 @@ sal_Bool VCLXAccessibleStatusBarItem::copyText( sal_Int32 nStartIndex, sal_Int32
OUString sText( getTextRange( nStartIndex, nEndIndex ) );
::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, NULL );
Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
if( xFlushableClipboard.is() )
xFlushableClipboard->flushClipboard();
Application::AcquireSolarMutex( nRef );
bReturn = true;
}
}

View File

@ -665,15 +665,14 @@ sal_Bool VCLXAccessibleTabPage::copyText( sal_Int32 nStartIndex, sal_Int32 nEndI
OUString sText( getTextRange( nStartIndex, nEndIndex ) );
::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, NULL );
Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
if( xFlushableClipboard.is() )
xFlushableClipboard->flushClipboard();
Application::AcquireSolarMutex( nRef );
bReturn = true;
}
}

View File

@ -384,15 +384,14 @@ sal_Bool VCLXAccessibleTextComponent::copyText( sal_Int32 nStartIndex, sal_Int32
OUString sText( getTextRange( nStartIndex, nEndIndex ) );
::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, NULL );
Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
if( xFlushableClipboard.is() )
xFlushableClipboard->flushClipboard();
Application::AcquireSolarMutex( nRef );
bReturn = true;
}
}

View File

@ -523,15 +523,14 @@ sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::copyText( sal_Int32 nStartIndex, sa
OUString sText( getTextRange( nStartIndex, nEndIndex ) );
::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, NULL );
Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
if( xFlushableClipboard.is() )
xFlushableClipboard->flushClipboard();
Application::AcquireSolarMutex( nRef );
bReturn = true;
}
}

View File

@ -1405,10 +1405,13 @@ bool ModulWindow::IsPasteAllowed()
Reference< datatransfer::clipboard::XClipboard > xClipboard = GetClipboard();
if ( xClipboard.is() )
{
// get clipboard content
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents();
Application::AcquireSolarMutex( nRef );
Reference< datatransfer::XTransferable > xTransf;
{
SolarMutexReleaser aReleaser;
// get clipboard content
xTransf = xClipboard->getContents();
}
if ( xTransf.is() )
{
datatransfer::DataFlavor aFlavor;

View File

@ -811,9 +811,8 @@ void DlgEditor::Copy()
aSeqData[0] = aDialogModelBytesAny;
pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavors , aSeqData );
}
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
xClipboard->setContents( pTrans , pTrans );
Application::AcquireSolarMutex( nRef );
}
}
@ -830,10 +829,13 @@ void DlgEditor::Paste()
Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow().GetClipboard();
if ( xClipboard.is() )
{
// get clipboard content
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents();
Application::AcquireSolarMutex( nRef );
Reference< datatransfer::XTransferable > xTransf;
{
SolarMutexReleaser aReleaser;
// get clipboard content
xTransf = xClipboard->getContents();
}
if ( xTransf.is() )
{
// Is target dialog (library) localized?
@ -1061,9 +1063,9 @@ bool DlgEditor::IsPasteAllowed()
if ( xClipboard.is() )
{
// get clipboard content
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents();
Application::AcquireSolarMutex( nRef );
return xTransf.is() && xTransf->isDataFlavorSupported( m_ClipboardDataFlavors[0] );
}
return false;

View File

@ -204,18 +204,15 @@ void HexColorControl::Paste()
{
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj;
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
try
{
SolarMutexReleaser aReleaser;
xDataObj = aClipboard->getContents();
}
catch( const ::com::sun::star::uno::Exception& )
{
}
Application::AcquireSolarMutex( nRef );
if ( xDataObj.is() )
{
::com::sun::star::datatransfer::DataFlavor aFlavor;

View File

@ -1588,22 +1588,22 @@ int Desktop::Main()
}
// Release solar mutex just before we wait for our client to connect
int nAcquireCount = Application::ReleaseSolarMutex();
{
SolarMutexReleaser aReleaser;
// Post user event to startup first application component window
// We have to send this OpenClients message short before execute() to
// minimize the risk that this message overtakes type detection construction!!
Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
// Post user event to startup first application component window
// We have to send this OpenClients message short before execute() to
// minimize the risk that this message overtakes type detection construction!!
Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
// Post event to enable acceptors
Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) );
// Post event to enable acceptors
Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) );
// The configuration error handler currently is only for startup
aConfigErrHandler.deactivate();
// The configuration error handler currently is only for startup
aConfigErrHandler.deactivate();
// Acquire solar mutex just before we enter our message loop
if ( nAcquireCount )
Application::AcquireSolarMutex( nAcquireCount );
// Acquire solar mutex just before we enter our message loop
}
// call Application::Execute to process messages in vcl message loop
SAL_INFO( "desktop.app", "PERFORMANCE - enter Application::Execute()" );
@ -1711,12 +1711,13 @@ int Desktop::doShutdown()
FlushConfiguration();
// The acceptors in the AcceptorMap must be released (in DeregisterServices)
// with the solar mutex unlocked, to avoid deadlock:
sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
DeregisterServices();
{
SolarMutexReleaser aReleaser;
DeregisterServices();
#if HAVE_FEATURE_SCRIPTING
StarBASIC::DetachAllDocBasicItems();
StarBASIC::DetachAllDocBasicItems();
#endif
Application::AcquireSolarMutex(nAcquireCount);
}
// be sure that path/language options gets destroyed before
// UCB is deinitialized
SAL_INFO( "desktop.app", "-> dispose path/language options" );

View File

@ -1313,22 +1313,23 @@ void ImpEditView::CutCopy( ::com::sun::star::uno::Reference< ::com::sun::star::d
{
uno::Reference<datatransfer::XTransferable> xData = pEditEngine->CreateTransferable( GetEditSelection() );
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
try
{
rxClipboard->setContents( xData, NULL );
SolarMutexReleaser aReleaser;
// #87756# FlushClipboard, but it would be better to become a TerminateListener to the Desktop and flush on demand...
uno::Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( rxClipboard, uno::UNO_QUERY );
if( xFlushableClipboard.is() )
xFlushableClipboard->flushClipboard();
}
catch( const ::com::sun::star::uno::Exception& )
{
}
try
{
rxClipboard->setContents( xData, NULL );
Application::AcquireSolarMutex( nRef );
// #87756# FlushClipboard, but it would be better to become a TerminateListener to the Desktop and flush on demand...
uno::Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( rxClipboard, uno::UNO_QUERY );
if( xFlushableClipboard.is() )
xFlushableClipboard->flushClipboard();
}
catch( const ::com::sun::star::uno::Exception& )
{
}
}
if ( bCut )
{
@ -1346,17 +1347,14 @@ void ImpEditView::Paste( ::com::sun::star::uno::Reference< ::com::sun::star::dat
{
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() && EditEngine::HasValidData( xDataObj ) )
{

View File

@ -730,15 +730,15 @@ void BibFrameController_Impl::addStatusListener(
if(xClip.is())
{
uno::Reference< datatransfer::XTransferable > xDataObj;
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
try
{
xDataObj = xClip->getContents();
}
{
SolarMutexReleaser aReleaser;
xDataObj = xClip->getContents();
}
catch( const uno::Exception& )
{
}
Application::AcquireSolarMutex( nRef );
{
}
if ( xDataObj.is() )
{

View File

@ -28,7 +28,7 @@ namespace vista{
static void lcl_sleep( ::osl::Condition& aCondition,
::sal_Int32 nMilliSeconds )
{
sal_uLong nAcquireCount = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
if (nMilliSeconds < 1)
aCondition.wait(0);
@ -39,8 +39,6 @@ static void lcl_sleep( ::osl::Condition& aCondition,
aTime.Nanosec = (nMilliSeconds % 1000) * 1000000;
aCondition.wait(&aTime);
}
Application::AcquireSolarMutex( nAcquireCount );
}
void Request::wait( ::sal_Int32 nMilliSeconds )

View File

@ -198,7 +198,7 @@ throw ( RuntimeException, std::exception )
IMPL_STATIC_LINK_NOINSTANCE( ComplexToolbarController, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo )
{
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
try
{
// Asynchronous execution as this can lead to our own destruction!
@ -210,14 +210,13 @@ IMPL_STATIC_LINK_NOINSTANCE( ComplexToolbarController, ExecuteHdl_Impl, ExecuteI
{
}
Application::AcquireSolarMutex( nRef );
delete pExecuteInfo;
return 0;
}
IMPL_STATIC_LINK_NOINSTANCE( ComplexToolbarController, Notify_Impl, NotifyInfo*, pNotifyInfo )
{
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
try
{
// Asynchronous execution: As this can lead to our own destruction!
@ -233,7 +232,6 @@ IMPL_STATIC_LINK_NOINSTANCE( ComplexToolbarController, Notify_Impl, NotifyInfo*,
{
}
Application::AcquireSolarMutex( nRef );
delete pNotifyInfo;
return 0;
}

View File

@ -271,7 +271,7 @@ throw ( RuntimeException, std::exception )
IMPL_STATIC_LINK_NOINSTANCE( GenericToolbarController, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo )
{
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
try
{
// Asynchronous execution as this can lead to our own destruction!
@ -283,7 +283,6 @@ IMPL_STATIC_LINK_NOINSTANCE( GenericToolbarController, ExecuteHdl_Impl, ExecuteI
{
}
Application::AcquireSolarMutex( nRef );
delete pExecuteInfo;
return 0;
}

View File

@ -1019,9 +1019,8 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu )
if ( xDispatch.is() )
{
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
xDispatch->dispatch( aTargetURL, aArgs );
Application::AcquireSolarMutex( nRef );
}
return 1;

View File

@ -756,15 +756,13 @@ sal_Bool SAL_CALL SmGraphicAccessible::copyText(
OUString sText( getTextRange(nStartIndex, nEndIndex) );
::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, NULL );
Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
if( xFlushableClipboard.is() )
xFlushableClipboard->flushClipboard();
Application::AcquireSolarMutex( nRef );
bReturn = true;
}
}

View File

@ -571,7 +571,7 @@ void TransferableHelper::ImplFlush()
if( mxClipboard.is() )
{
Reference< XFlushableClipboard > xFlushableClipboard( mxClipboard, UNO_QUERY );
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
try
{
@ -582,8 +582,6 @@ void TransferableHelper::ImplFlush()
{
OSL_FAIL( "Could not flush clipboard" );
}
Application::AcquireSolarMutex( nRef );
}
}
@ -1019,7 +1017,7 @@ void TransferableHelper::CopyToClipboard( vcl::Window *pWindow ) const
if( mxClipboard.is() && !mxTerminateListener.is() )
{
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
try
{
@ -1032,8 +1030,6 @@ void TransferableHelper::CopyToClipboard( vcl::Window *pWindow ) const
catch( const ::com::sun::star::uno::Exception& )
{
}
Application::AcquireSolarMutex( nRef );
}
}
@ -1049,7 +1045,7 @@ void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const
if( xSelection.is() && !mxTerminateListener.is() )
{
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
try
{
@ -1062,8 +1058,6 @@ void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const
catch( const ::com::sun::star::uno::Exception& )
{
}
Application::AcquireSolarMutex( nRef );
}
}
@ -1092,7 +1086,7 @@ void TransferableHelper::StartDrag( vcl::Window* pWindow, sal_Int8 nDnDSourceAct
// we can receive drag events from the system only in the main
// thread
#if !defined(MACOSX)
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
#endif
try
@ -1108,11 +1102,6 @@ void TransferableHelper::StartDrag( vcl::Window* pWindow, sal_Int8 nDnDSourceAct
catch( const ::com::sun::star::uno::Exception& )
{
}
// See above for the reason of this define
#if !defined(MACOSX)
Application::AcquireSolarMutex( nRef );
#endif
}
}
@ -2283,24 +2272,22 @@ TransferableDataHelper TransferableDataHelper::CreateFromSelection( vcl::Window*
if( xSelection.is() )
{
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
try
{
Reference< XTransferable > xTransferable( xSelection->getContents() );
if( xTransferable.is() )
try
{
aRet = TransferableDataHelper( xTransferable );
aRet.mxClipboard = xSelection;
}
}
catch( const ::com::sun::star::uno::Exception& )
{
}
Reference< XTransferable > xTransferable( xSelection->getContents() );
Application::AcquireSolarMutex( nRef );
}
if( xTransferable.is() )
{
aRet = TransferableDataHelper( xTransferable );
aRet.mxClipboard = xSelection;
}
}
catch( const ::com::sun::star::uno::Exception& )
{
}
}
return aRet;
}

View File

@ -612,7 +612,7 @@ ContextMenuHelper::completeMenuProperties(
IMPL_STATIC_LINK_NOINSTANCE( ContextMenuHelper, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo )
{
// Release solar mutex to prevent deadlocks with clipboard thread
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
try
{
// Asynchronous execution as this can lead to our own destruction while we are
@ -623,8 +623,6 @@ IMPL_STATIC_LINK_NOINSTANCE( ContextMenuHelper, ExecuteHdl_Impl, ExecuteInfo*, p
{
}
// Acquire solar mutex again
Application::AcquireSolarMutex( nRef );
delete pExecuteInfo;
return 0;
}

View File

@ -608,7 +608,7 @@ public:
IMPL_STATIC_LINK_NOINSTANCE( AsyncExecute, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo )
{
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
try
{
// Asynchronous execution as this can lead to our own destruction!
@ -620,7 +620,6 @@ IMPL_STATIC_LINK_NOINSTANCE( AsyncExecute, ExecuteHdl_Impl, ExecuteInfo*, pExecu
{
}
Application::AcquireSolarMutex( nRef );
delete pExecuteInfo;
return 0;
}

View File

@ -178,9 +178,8 @@ UUIInteractionHelper::handleRequest(
HandleData aHD(rRequest);
Link aLink(&aHD,handlerequest);
Application::PostUserEvent(aLink,this);
sal_uLong locks = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
aHD.wait();
Application::AcquireSolarMutex(locks);
return aHD.bHandled;
}
else
@ -235,9 +234,8 @@ UUIInteractionHelper::getStringFromRequest(
HandleData aHD(rRequest);
Link aLink(&aHD,getstringfromrequest);
Application::PostUserEvent(aLink,this);
sal_uLong locks = Application::ReleaseSolarMutex();
SolarMutexReleaser aReleaser;
aHD.wait();
Application::AcquireSolarMutex(locks);
return aHD.m_aResult;
}
else

View File

@ -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 )

View File

@ -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 )

View File

@ -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

View File

@ -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;

View File

@ -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() )
{

View File

@ -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;
}

View File

@ -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 );
}
}
}