diff options
author | Tor Lillqvist <tml@iki.fi> | 2022-04-19 16:40:11 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2022-04-20 14:06:51 +0200 |
commit | 63bad2bf8dc0d1052532e92be1a18118c0398fbf (patch) | |
tree | b8aa0df7acfc23539f70de53450f26700425f0b9 /desktop | |
parent | 956a01947d869247e5e117105a1e17edd46bfce1 (diff) |
Fix regression in the iOS app (and possibly the Android and GTK apps)
The problem was caused by my remote font downloading changes. We need
to be more careful in lo_initialize() and libreofficekit_hook_2() to
distinguish whether the code is called from "normal" Online (with
"pre-initialisation" through lok_preinit_2()) or otherwise, for
instance the iOS app, where not pre-initialisation is done.
Sadly, this fix makes state handling in init.cxx even more complex
with one more static Boolean flag.
Change-Id: I2a8fa96740eb79725aa162cf7adc86d49a8ba603
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133175
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133196
Tested-by: Jenkins
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7b99ed49fdc9..9a4ec4881805 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -196,6 +196,7 @@ using namespace desktop; using namespace utl; static LibLibreOffice_Impl *gImpl = nullptr; +static bool lok_preinit_2_called = false; static std::weak_ptr< LibreOfficeKitClass > gOfficeClass; static std::weak_ptr< LibreOfficeKitDocumentClass > gDocumentClass; @@ -6494,8 +6495,11 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char if (pThis == nullptr) { eStage = PRE_INIT; - SAL_INFO("lok", "Create libreoffice object"); - gImpl = new LibLibreOffice_Impl(); + if (lok_preinit_2_called) + { + SAL_INFO("lok", "Create libreoffice object"); + gImpl = new LibLibreOffice_Impl(); + } } else if (bPreInited) eStage = SECOND_INIT; @@ -6782,10 +6786,16 @@ LibreOfficeKit *libreofficekit_hook_2(const char* install_path, const char* user { static bool alreadyCalled = false; - if (!alreadyCalled) + if ((!lok_preinit_2_called && !gImpl) || (lok_preinit_2_called && !alreadyCalled)) { alreadyCalled = true; + if (!lok_preinit_2_called) + { + SAL_INFO("lok", "Create libreoffice object"); + gImpl = new LibLibreOffice_Impl(); + } + if (!lo_initialize(gImpl, install_path, user_profile_url)) { lo_destroy(gImpl); @@ -6809,6 +6819,7 @@ int lok_preinit(const char* install_path, const char* user_profile_url) SAL_JNI_EXPORT int lok_preinit_2(const char* install_path, const char* user_profile_url, LibLibreOffice_Impl** kit) { + lok_preinit_2_called = true; int result = lo_initialize(nullptr, install_path, user_profile_url); if (kit != nullptr) *kit = gImpl; |