summaryrefslogtreecommitdiff
path: root/vcl/unx/kde4
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2017-08-15 08:05:51 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2017-09-19 09:25:14 +0200
commit3840aede596e6fc24f7ed7df9100fb028134aac6 (patch)
tree74d1d5efa3b2ad5448181fc185faf226aed192e4 /vcl/unx/kde4
parent10b49dfb3996f99dec8dd0d2ffae2aef4022f395 (diff)
Unify SolarMutex implementations
All backends implement the SolarMutex in mostly the same way. So this consolidates this code into a GenericSolarMutex. We still need the abstract SolarMutex class for the fake AKA fascade implementation in dbaccess. The patch also replaces various places of direct mutex usage with either SolarMutexGuard or SolarMutexReleaser objects. Change-Id: Ia0146dd6c51a3b9a513cc6af34a66def58aad831 Reviewed-on: https://gerrit.libreoffice.org/42325 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/unx/kde4')
-rw-r--r--vcl/unx/kde4/KDE4FilePicker.cxx40
-rw-r--r--vcl/unx/kde4/KDESalDisplay.cxx3
-rw-r--r--vcl/unx/kde4/KDEXLib.cxx6
3 files changed, 24 insertions, 25 deletions
diff --git a/vcl/unx/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx
index 133975da36f1..c004ef8d4a69 100644
--- a/vcl/unx/kde4/KDE4FilePicker.cxx
+++ b/vcl/unx/kde4/KDE4FilePicker.cxx
@@ -200,7 +200,7 @@ KDE4FilePicker::~KDE4FilePicker()
void KDE4FilePicker::cleanupProxy()
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser aReleaser;
+ SolarMutexReleaser aReleaser;
return Q_EMIT cleanupProxySignal();
}
delete _dialog;
@@ -221,7 +221,7 @@ void SAL_CALL KDE4FilePicker::removeFilePickerListener( const uno::Reference<XFi
void SAL_CALL KDE4FilePicker::setTitle( const OUString &title )
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser aReleaser;
+ SolarMutexReleaser aReleaser;
return Q_EMIT setTitleSignal( title );
}
@@ -231,7 +231,7 @@ void SAL_CALL KDE4FilePicker::setTitle( const OUString &title )
sal_Int16 SAL_CALL KDE4FilePicker::execute()
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser aReleaser;
+ SolarMutexReleaser aReleaser;
return Q_EMIT executeSignal();
}
@@ -267,7 +267,7 @@ sal_Int16 SAL_CALL KDE4FilePicker::execute()
void SAL_CALL KDE4FilePicker::setMultiSelectionMode( sal_Bool multiSelect )
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT setMultiSelectionModeSignal( multiSelect );
}
@@ -290,7 +290,7 @@ void SAL_CALL KDE4FilePicker::setMultiSelectionMode( sal_Bool multiSelect )
void SAL_CALL KDE4FilePicker::setDefaultName( const OUString &name )
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT setDefaultNameSignal( name );
}
@@ -301,7 +301,7 @@ void SAL_CALL KDE4FilePicker::setDefaultName( const OUString &name )
void SAL_CALL KDE4FilePicker::setDisplayDirectory( const OUString &dir )
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT setDisplayDirectorySignal( dir );
}
@@ -312,7 +312,7 @@ void SAL_CALL KDE4FilePicker::setDisplayDirectory( const OUString &dir )
OUString SAL_CALL KDE4FilePicker::getDisplayDirectory()
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT getDisplayDirectorySignal();
}
@@ -323,7 +323,7 @@ OUString SAL_CALL KDE4FilePicker::getDisplayDirectory()
uno::Sequence< OUString > SAL_CALL KDE4FilePicker::getFiles()
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT getFilesSignal();
}
uno::Sequence< OUString > seq = getSelectedFiles();
@@ -335,7 +335,7 @@ uno::Sequence< OUString > SAL_CALL KDE4FilePicker::getFiles()
uno::Sequence< OUString > SAL_CALL KDE4FilePicker::getSelectedFiles()
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT getSelectedFilesSignal();
}
KUrl::List urls = _dialog->selectedUrls();
@@ -349,7 +349,7 @@ uno::Sequence< OUString > SAL_CALL KDE4FilePicker::getSelectedFiles()
void SAL_CALL KDE4FilePicker::appendFilter( const OUString &title, const OUString &filter )
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT appendFilterSignal( title, filter );
}
@@ -375,7 +375,7 @@ void SAL_CALL KDE4FilePicker::appendFilter( const OUString &title, const OUStrin
void SAL_CALL KDE4FilePicker::setCurrentFilter( const OUString &title )
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT setCurrentFilterSignal( title );
}
@@ -385,7 +385,7 @@ void SAL_CALL KDE4FilePicker::setCurrentFilter( const OUString &title )
OUString SAL_CALL KDE4FilePicker::getCurrentFilter()
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT getCurrentFilterSignal();
}
@@ -405,7 +405,7 @@ OUString SAL_CALL KDE4FilePicker::getCurrentFilter()
void SAL_CALL KDE4FilePicker::appendFilterGroup( const OUString& rGroupTitle, const uno::Sequence<beans::StringPair>& filters)
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT appendFilterGroupSignal( rGroupTitle, filters );
}
@@ -420,7 +420,7 @@ void SAL_CALL KDE4FilePicker::appendFilterGroup( const OUString& rGroupTitle, co
void SAL_CALL KDE4FilePicker::setValue( sal_Int16 controlId, sal_Int16 nControlAction, const uno::Any &value )
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT setValueSignal( controlId, nControlAction, value );
}
@@ -444,7 +444,7 @@ uno::Any SAL_CALL KDE4FilePicker::getValue( sal_Int16 controlId, sal_Int16 nCont
return uno::Any( false );
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT getValueSignal( controlId, nControlAction );
}
@@ -463,7 +463,7 @@ uno::Any SAL_CALL KDE4FilePicker::getValue( sal_Int16 controlId, sal_Int16 nCont
void SAL_CALL KDE4FilePicker::enableControl( sal_Int16 controlId, sal_Bool enable )
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT enableControlSignal( controlId, enable );
}
@@ -476,7 +476,7 @@ void SAL_CALL KDE4FilePicker::enableControl( sal_Int16 controlId, sal_Bool enabl
void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 controlId, const OUString &label )
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT setLabelSignal( controlId, label );
}
@@ -492,7 +492,7 @@ void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 controlId, const OUString &lab
OUString SAL_CALL KDE4FilePicker::getLabel(sal_Int16 controlId)
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT getLabelSignal( controlId );
}
@@ -607,7 +607,7 @@ void KDE4FilePicker::addCustomControl(sal_Int16 controlId)
void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args )
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT initializeSignal( args );
}
@@ -767,7 +767,7 @@ uno::Sequence< OUString > SAL_CALL KDE4FilePicker::getSupportedServiceNames()
void KDE4FilePicker::checkProtocol()
{
if( qApp->thread() != QThread::currentThread() ) {
- SalYieldMutexReleaser rel;
+ SolarMutexReleaser aReleaser;
return Q_EMIT checkProtocolSignal();
}
diff --git a/vcl/unx/kde4/KDESalDisplay.cxx b/vcl/unx/kde4/KDESalDisplay.cxx
index 7c30c7aa40c9..4647b3d111c8 100644
--- a/vcl/unx/kde4/KDESalDisplay.cxx
+++ b/vcl/unx/kde4/KDESalDisplay.cxx
@@ -54,8 +54,7 @@ void SalKDEDisplay::Yield()
if (XEventsQueued( pDisp_, QueuedAfterReading ) == 0)
return;
- DBG_ASSERT( static_cast<SalYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex())->GetThreadId() ==
- osl::Thread::getCurrentIdentifier(),
+ DBG_ASSERT( GetSalData()->m_pInstance->GetYieldMutex()->IsCurrentThread(),
"will crash soon since solar mutex not locked in SalKDEDisplay::Yield" );
XEvent event;
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index a44b9f1a3233..d9e049142c1a 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -208,7 +208,7 @@ static GPollFunc old_gpoll = nullptr;
static gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout )
{
- SalYieldMutexReleaser release; // release YieldMutex (and re-acquire at block end)
+ SolarMutexReleaser aReleaser;
return old_gpoll( ufds, nfds, timeout );
}
#endif
@@ -292,7 +292,7 @@ bool KDEXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
// release the yield lock to prevent deadlock with the main thread
// (it's ok to release it here, since even normal processYield() would
// temporarily do it while checking for new events)
- SalYieldMutexReleaser aReleaser;
+ SolarMutexReleaser aReleaser;
Q_EMIT processYieldSignal( bWait, bHandleAllCurrentEvents );
return false;
}
@@ -382,7 +382,7 @@ uno::Reference< ui::dialogs::XFilePicker2 > KDEXLib::createFilePicker(
{
#if KDE4_HAVE_GLIB
if( qApp->thread() != QThread::currentThread()) {
- SalYieldMutexReleaser aReleaser;
+ SolarMutexReleaser aReleaser;
return Q_EMIT createFilePickerSignal( xMSF );
}
return uno::Reference< ui::dialogs::XFilePicker2 >( new KDE4FilePicker( xMSF ) );