[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - ios/ios.h ios/ios.mm ios/Mobile wsd/LOOLWSD.cpp
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 15 15:34:08 UTC 2019
ios/Mobile/DocumentViewController.mm | 4 ++++
ios/ios.h | 4 ++++
ios/ios.mm | 1 +
wsd/LOOLWSD.cpp | 3 +++
4 files changed, 12 insertions(+)
New commits:
commit a83902f6b688e4112fc7402347e41e30b033d37d
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Oct 15 18:15:22 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Oct 15 18:30:53 2019 +0300
tdf#123733: Keep the WebKit view until the lokit_main thread has finished
Otherwise, if you close a document before it has been rendered
completely, the plumbing of threads and FakeSocket connections gets
confused and opening the next document hangs, or runs into an
assertion failure in FakeSocket.cpp. This typically happened for large
presentations where rendering the slide previews takes significant
time.
Change-Id: I0f586bec021c4c045a129b3f179ddb3942915c58
diff --git a/ios/Mobile/DocumentViewController.mm b/ios/Mobile/DocumentViewController.mm
index 183e57250..c9d8c5cac 100644
--- a/ios/Mobile/DocumentViewController.mm
+++ b/ios/Mobile/DocumentViewController.mm
@@ -265,6 +265,10 @@
LOG_TRC("save completion handler gets " << (success?"YES":"NO"));
}];
+ // Wait for lokit_main thread to exit
+ std::lock_guard<std::mutex> lock(lokit_main_mutex);
+
+ // And only then let the document browsing view show up again
[self dismissDocumentViewController];
return;
} else if ([message.body isEqualToString:@"SLIDESHOW"]) {
diff --git a/ios/ios.h b/ios/ios.h
index b5918fac3..b54f10305 100644
--- a/ios/ios.h
+++ b/ios/ios.h
@@ -7,6 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <mutex>
+
#include <LibreOfficeKit/LibreOfficeKit.hxx>
extern int loolwsd_server_socket_fd;
@@ -15,4 +17,6 @@ extern lok::Document *lok_document;
extern LibreOfficeKit *lo_kit;
+extern std::mutex lokit_main_mutex;
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ios/ios.mm b/ios/ios.mm
index d31e62862..1416d31e0 100644
--- a/ios/ios.mm
+++ b/ios/ios.mm
@@ -20,5 +20,6 @@ extern "C" {
int loolwsd_server_socket_fd = -1;
lok::Document *lok_document;
LibreOfficeKit *lo_kit;
+std::mutex lokit_main_mutex;
// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 2c47170c4..054cf9f17 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -511,6 +511,9 @@ std::shared_ptr<ChildProcess> getNewChild_Blocks(
std::thread([&]
{
+#ifdef IOS
+ std::lock_guard<std::mutex> lokit_main_lock(lokit_main_mutex);
+#endif
Util::setThreadName("lokit_main");
// Ugly to have that static global, otoh we know there is just one LOOLWSD
More information about the Libreoffice-commits
mailing list