summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2019-05-20 23:53:12 +0300
committerMichael Meeks <michael.meeks@collabora.com>2019-08-05 21:06:40 -0400
commita840f69e11e336f48275a10b253de72833275ad8 (patch)
tree06090991fd0afc3bf169fe06e928fc4ffdb56d4e /toolkit
parentc7dce3151323105158e3c4d10b5256a0af09ab3d (diff)
tdf#125397: Fixes for threads and SolarMutex on iOS
We need to call SfxApplication::GetOrCreate() in lo_initialize() now. Otherwise we will crash in sfx2. No idea why it worked earlier. I think we want to avoid the "VCLXToolkit VCL main thread" ever running in the iOS app. I don't think we had it running earlier, but now for some reason it got started when creating a document from a template, and that seemed to cause a hang. Also, when creating a document from a template, lo_initialize() is called from the app's real main thread (the one that the process starts in). In that case we do want to release the SolarMutex after InitVCL() if this was the first time we called InitVCL(). Awful crack. Not really sure I fully understand all that is going on, but this change does seem to fix recent problems... All this thread and SolarMutex stuff is so incredibly fragile. Change-Id: Ib04498ad199b64f27701f89d2df7003bca316406
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 31d1fe549e97..152dcadd679a 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -833,6 +833,8 @@ bool lcl_convertMessageBoxType(
return ( eVal != css::awt::MessageBoxType::MessageBoxType_MAKE_FIXED_SIZE );
}
+#ifndef IOS
+
static sal_Int32 nVCLToolkitInstanceCount = 0;
static bool bInitedByVCLToolkit = false;
@@ -903,6 +905,8 @@ static void ToolkitWorkerFunction( void* pArgs )
}
}
+#endif
+
// constructor, which might initialize VCL
VCLXToolkit::VCLXToolkit():
cppu::WeakComponentImplHelper<
@@ -920,6 +924,7 @@ VCLXToolkit::VCLXToolkit():
hSvToolsLib = nullptr;
fnSvtCreateWindow = nullptr;
+#ifndef IOS
osl::Guard< osl::Mutex > aGuard( getInitMutex() );
nVCLToolkitInstanceCount++;
if( ( nVCLToolkitInstanceCount == 1 ) && ( !Application::IsInMain() ) )
@@ -928,6 +933,7 @@ VCLXToolkit::VCLXToolkit():
CreateMainLoopThread( ToolkitWorkerFunction, this );
getInitCondition().wait();
}
+#endif
}
void SAL_CALL VCLXToolkit::disposing()
@@ -941,6 +947,7 @@ void SAL_CALL VCLXToolkit::disposing()
}
#endif
+#ifndef IOS
{
osl::Guard< osl::Mutex > aGuard( getInitMutex() );
if( --nVCLToolkitInstanceCount == 0 )
@@ -953,7 +960,7 @@ void SAL_CALL VCLXToolkit::disposing()
}
}
}
-
+#endif
if (m_bEventListener)
{
::Application::RemoveEventListener(m_aEventListenerLink);