Mobile/Mobile/DocumentViewController.mm | 4 +++- kit/Kit.cpp | 5 +++++ net/Socket.hpp | 12 ++++++++++++ wsd/LOOLWSD.cpp | 8 -------- 4 files changed, 20 insertions(+), 9 deletions(-)
New commits: commit d1e550f01e113feff8819153becb4dd3035c21bf Author: Tor Lillqvist <[email protected]> AuthorDate: Wed Oct 17 20:06:15 2018 +0300 Commit: Tor Lillqvist <[email protected]> CommitDate: Wed Oct 17 20:10:52 2018 +0300 Reset the global 'document' variable to null when not needed any more Doesn't matter in "real" Online where the kit process will die shortly after that ayway, but matters a lot in the mobile app, where there is just one process all the time that handles document after document. Now I can successfully load another document after closing the first in the iOS app. diff --git a/kit/Kit.cpp b/kit/Kit.cpp index fd5869cde..10e1cb48b 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -2135,6 +2135,7 @@ protected: { LOG_TRC("Setting TerminationFlag due to 'exit' command from parent."); TerminationFlag = true; + document.reset(); } else if (tokens[0] == "tile" || tokens[0] == "tilecombine" || tokens[0] == "canceltiles" || tokens[0] == "paintwindow" || commit fb8e6dd820c876851c5c37af89605b82fdfde9a7 Author: Tor Lillqvist <[email protected]> AuthorDate: Wed Oct 17 20:04:20 2018 +0300 Commit: Tor Lillqvist <[email protected]> CommitDate: Wed Oct 17 20:10:52 2018 +0300 For MOBILEAPP, don't set TerminationFlag in KitWebSocketHandler::onDisconnect() Helps in the struggle to get loading of another document after closing the first to work. diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 1a36b8fe3..fd5869cde 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -2167,8 +2167,10 @@ protected: void onDisconnect() override { +#ifndef MOBILEAPP LOG_WRN("Kit connection lost without exit arriving from wsd. Setting TerminationFlag"); TerminationFlag = true; +#endif } }; commit bd8d612c9fb9e8c172c7cc3eda010d424de7a606 Author: Tor Lillqvist <[email protected]> AuthorDate: Wed Oct 17 20:00:59 2018 +0300 Commit: Tor Lillqvist <[email protected]> CommitDate: Wed Oct 17 20:10:52 2018 +0300 In the MOBILEAPP case, don't set TerminationFlag when there are no sessions The global TerminationFlag is an abomination that has caused lots of trouble when developing the mobile app. The less we use it the better. Here, it gets set elsewhere already when needed; just having no sessions is not reason enough to set it. diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 5ea4ad563..1a36b8fe3 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -2492,11 +2492,13 @@ void lokit_main( { mainKit.poll(SocketPoll::DefaultPollTimeoutMs); +#ifndef MOBILEAPP if (document && document->purgeSessions() == 0) { LOG_INF("Last session discarded. Setting TerminationFlag"); TerminationFlag = true; } +#endif } LOG_INF("Kit poll terminated."); commit 05c2782a815128609ce94aef86604aa8a42ed061 Author: Tor Lillqvist <[email protected]> AuthorDate: Wed Oct 17 19:55:25 2018 +0300 Commit: Tor Lillqvist <[email protected]> CommitDate: Wed Oct 17 20:10:52 2018 +0300 Empty out _newCallbacks when stopping a SocketPoll in the MOBILEAPP case The wakeup() call in SocketPoll::stop() doesn't always (or ever?) actually cause the wakeup code to be invoked and callbacks called right after, and we don't want to risk the leftover callbacks being invoked when the same SocketPoll object is started again. (This did actually happen.) In a normal Online, this is not a problem, as SocketPolls aren't reused. One document per kit process, a separate kit process for each document. Not so in a mobile app, there we have just one process that handles document after document as the user closes one, opens another (or the same anew), etc. diff --git a/net/Socket.hpp b/net/Socket.hpp index 8cc363f12..734d3696a 100644 --- a/net/Socket.hpp +++ b/net/Socket.hpp @@ -391,6 +391,18 @@ public: { LOG_DBG("Stopping " << _name << "."); _stop = true; +#ifdef MOBILEAPP + { + // We don't want to risk some callbacks in _newCallbacks being invoked when we start + // running a thread for this SocketPoll again. + std::lock_guard<std::mutex> lock(_mutex); + if (_newCallbacks.size() > 0) + { + LOG_TRC("_newCallbacks is non-empty, clearing it"); + _newCallbacks.clear(); + } + } +#endif wakeup(); } commit 9e8a2d3c7e1d44e75ae27a40cfadf7f3425df648 Author: Tor Lillqvist <[email protected]> AuthorDate: Wed Oct 17 17:09:00 2018 +0300 Commit: Tor Lillqvist <[email protected]> CommitDate: Wed Oct 17 17:09:04 2018 +0300 Bin a couple of less useful LOG_INFs inside #ifndef MOBILEAPP Always good to get rid of ifdefs. diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index c81862c44..448b92748 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -2844,10 +2844,6 @@ private: std::shared_ptr<ServerSocket> findPrisonerServerPort(int& port) { std::shared_ptr<SocketFactory> factory = std::make_shared<PrisonerSocketFactory>(); - -#ifndef MOBILEAPP - LOG_INF("Trying to listen on prisoner port " << port << "."); -#endif std::shared_ptr<ServerSocket> socket = getServerSocket( ServerSocket::Type::Local, port, PrisonerPoll, factory); @@ -2883,10 +2879,6 @@ private: /// Create the externally listening public socket std::shared_ptr<ServerSocket> findServerPort(int port) { -#ifndef MOBILEAPP - LOG_INF("Trying to listen on client port " << port << "."); -#endif - std::shared_ptr<SocketFactory> factory; #if ENABLE_SSL commit 0af2a52b3415e6f564655a05efb1fa7724c37cf6 Author: Tor Lillqvist <[email protected]> AuthorDate: Wed Oct 17 15:59:19 2018 +0300 Commit: Tor Lillqvist <[email protected]> CommitDate: Wed Oct 17 15:59:19 2018 +0300 Add a completion handler that logs the success value diff --git a/Mobile/Mobile/DocumentViewController.mm b/Mobile/Mobile/DocumentViewController.mm index 3a6660dc0..32f211c5e 100644 --- a/Mobile/Mobile/DocumentViewController.mm +++ b/Mobile/Mobile/DocumentViewController.mm @@ -74,7 +74,9 @@ - (IBAction)dismissDocumentViewController { [self dismissViewControllerAnimated:YES completion:^ { - [self.document closeWithCompletionHandler:nil]; + [self.document closeWithCompletionHandler:^(BOOL success){ + NSLog(@"close completion handler gets %s", (success?"YES":"NO")); + }]; }]; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
