[Libreoffice-commits] online.git: ios/ios.h ios/ios.mm ios/Mobile wsd/LOOLWSD.cpp
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 16 11:20:57 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 fdb91bf15e04f182311cd263d2492aeb1c3f276f
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Oct 15 18:15:22 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Oct 16 13:20:38 2019 +0200
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. This typically happened for large presentations where
rendering the slide previews takes significant time.
Change-Id: I0f586bec021c4c045a129b3f179ddb3942915c58
Reviewed-on: https://gerrit.libreoffice.org/80882
Reviewed-by: Tor Lillqvist <tml at collabora.com>
Tested-by: Tor Lillqvist <tml at collabora.com>
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 a787855bd..7eb1e8357 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;
@@ -14,4 +16,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 c39f62d99..c610606a9 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -515,6 +515,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