[Libreoffice-commits] online.git: 2 commits - net/Socket.cpp wsd/DocumentBroker.cpp

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 8 14:36:27 UTC 2020


 net/Socket.cpp         |    5 +++++
 wsd/DocumentBroker.cpp |   21 +++++++++++++++++++++
 2 files changed, 26 insertions(+)

New commits:
commit c0706831b8f4c35d2a3b9939988c4894c44abebd
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Jul 8 17:28:45 2020 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Jul 8 17:35:40 2020 +0300

    Add comment describing what was not a good idea after all for the iOS app
    
    Change-Id: I43c760fa521f6a5860f2ed5dfef816ba5faaf463

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 009de809d..f198bb8e3 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1436,6 +1436,27 @@ size_t DocumentBroker::removeSession(const std::string& id)
                 << ", LastEditableSession: " << lastEditableSession << ", DontSaveIfUnmodified: "
                 << dontSaveIfUnmodified << ", IsPossiblyModified: " << isPossiblyModified());
 
+        // In theory, we almost could do this here:
+
+        // #if MOBILEAPP
+        // There is always just one "session" in a mobile app, and the same one process continues
+        // running, so no need to delay the disconnectSessionInternal() call. Doing it like this
+        // will also get rid of the docbroker and lokit_main thread for the document quicker.
+
+        // But, in reality it has unintended side effects on iOS because if you have done changes to
+        // the document, it does get saved, but that is only to the temporary copy. It is only in
+        // the document callback handler for LOK_CALLBACK_UNO_COMMAND_RESULT that we then call the
+        // system API to save that copy back to where it came from. See the
+        // LOK_CALLBACK_UNO_COMMAND_RESULT case in ChildSession::loKitCallback() in
+        // ChildSession.cpp. If we did use the below code snippet here, the document callback would
+        // get unregistered right away in Document::onUnload in Kit.cpp.
+
+        // autoSave(isPossiblyModified(), dontSaveIfUnmodified);
+        // disconnectSessionInternal(id);
+        // stop("stopped");
+
+        // So just go down the same code path as for normal Online:
+
         // If last editable, save and don't remove until after uploading to storage.
         if (!lastEditableSession || !autoSave(isPossiblyModified(), dontSaveIfUnmodified))
             disconnectSessionInternal(id);
commit 980b7b04a6a2f97989b8dfed3941251eda8c09e0
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Jul 8 17:19:02 2020 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Jul 8 17:34:20 2020 +0300

    Add a FIXME
    
    Change-Id: I7d54f77c5661b04616c04d1807966b9e1ccea485

diff --git a/net/Socket.cpp b/net/Socket.cpp
index 2f35b5cce..98822919c 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -288,6 +288,11 @@ int SocketPoll::poll(int64_t timeoutMaxMicroS)
     }
 
     // This should only happen when we're stopping.
+
+    // FIXME: A few dozen lines above we have potentially inserted new elements in _pollSockets, so
+    // clearly its size can now be larger than what it was when we came to this function, which got
+    // saved in the size variable.
+
     if (_pollSockets.size() != size)
         return rc;
 


More information about the Libreoffice-commits mailing list