[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 2 commits - desktop/source toolkit/source vcl/source
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 20 22:40:53 UTC 2019
desktop/source/lib/init.cxx | 14 +++++++++++++-
toolkit/source/awt/vclxtoolkit.cxx | 9 ++++++++-
vcl/source/window/window.cxx | 4 +++-
3 files changed, 24 insertions(+), 3 deletions(-)
New commits:
commit 30b8d352bdfd2128769f3ae1e8a3616118d3e754
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue May 21 01:26:53 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Tue May 21 01:37:33 2019 +0300
tdf#125397: Avoid crash if GetpApp() returns null, can happen on iOS at least
Change-Id: Ib0dfb00c6a00640fe35769f21f167bf3eae8769b
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index e22a0e34f25f..c3de69baea68 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2349,7 +2349,9 @@ void Window::Show(bool bVisible, ShowFlags nFlags)
if ( !pSVData->mpIntroWindow )
{
// The right way would be just to call this (not even in the 'if')
- GetpApp()->InitFinished();
+ auto pApp = GetpApp();
+ if ( pApp )
+ pApp->InitFinished();
}
else if ( !ImplIsWindowOrChild( pSVData->mpIntroWindow ) )
{
commit e897310c14c0f6176873c945503f097e62b6759d
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon May 20 23:53:12 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Tue May 21 01:36:43 2019 +0300
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
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b4d93861b0bd..da372deedda4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4710,7 +4710,6 @@ static void lo_runLoop(LibreOfficeKit* /*pThis*/,
void* pData)
{
#ifdef IOS // Maybe ANDROID, too?
- InitVCL();
Application::GetSolarMutex().acquire();
#endif
@@ -5030,6 +5029,19 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// CommandLineArgs):
desktop::Desktop::GetCommandLineArgs().setHeadless();
+#ifdef IOS
+ if (InitVCL() && [NSThread isMainThread])
+ {
+ static bool bFirstTime = true;
+ if (bFirstTime)
+ {
+ Application::GetSolarMutex().release();
+ bFirstTime = false;
+ }
+ }
+ SfxApplication::GetOrCreate();
+#endif
+
if (eStage == PRE_INIT)
{
{
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 4026093f997c..e0146208eb7a 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -586,6 +586,8 @@ namespace
}
}
+#ifndef IOS
+
static sal_Int32 nVCLToolkitInstanceCount = 0;
static bool bInitedByVCLToolkit = false;
@@ -674,6 +676,8 @@ static void SAL_CALL ToolkitWorkerFunction( void* pArgs )
}
}
+#endif
+
// constructor, which might initialize VCL
VCLXToolkit::VCLXToolkit():
cppu::WeakComponentImplHelper<
@@ -691,6 +695,7 @@ VCLXToolkit::VCLXToolkit():
hSvToolsLib = nullptr;
fnSvtCreateWindow = nullptr;
+#ifndef IOS
osl::Guard< osl::Mutex > aGuard( getInitMutex() );
nVCLToolkitInstanceCount++;
if( ( nVCLToolkitInstanceCount == 1 ) && ( !Application::IsInMain() ) )
@@ -699,6 +704,7 @@ VCLXToolkit::VCLXToolkit():
CreateMainLoopThread( ToolkitWorkerFunction, this );
getInitCondition().wait();
}
+#endif
}
void SAL_CALL VCLXToolkit::disposing()
@@ -712,6 +718,7 @@ void SAL_CALL VCLXToolkit::disposing()
}
#endif
+#ifndef IOS
{
osl::Guard< osl::Mutex > aGuard( getInitMutex() );
if( --nVCLToolkitInstanceCount == 0 )
@@ -724,7 +731,7 @@ void SAL_CALL VCLXToolkit::disposing()
}
}
}
-
+#endif
if (m_bEventListener)
{
::Application::RemoveEventListener(m_aEventListenerLink);
More information about the Libreoffice-commits
mailing list