[Libreoffice-commits] online.git: Branch 'distro/cib/libreoffice-6-2' - 2 commits - configure.ac wsd/ClientSession.cpp wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 5 10:43:58 UTC 2020


 configure.ac           |    2 +-
 wsd/ClientSession.cpp  |    6 ++++++
 wsd/DocumentBroker.cpp |    2 ++
 wsd/DocumentBroker.hpp |    5 +++++
 4 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit a73fed6c66fee1361efe808ce81ad777daa15563
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed Aug 5 12:43:27 2020 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Wed Aug 5 12:43:27 2020 +0200

    Release 6.2.11.0

diff --git a/configure.ac b/configure.ac
index 4b83ca624..ea556501b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
 
 AC_PREREQ([2.63])
 
-AC_INIT([loolwsd], [6.2.10.0], [libreoffice at lists.freedesktop.org])
+AC_INIT([loolwsd], [6.2.11.0], [libreoffice at lists.freedesktop.org])
 LT_INIT([shared, disable-static, dlopen])
 
 AM_INIT_AUTOMAKE([1.10 subdir-objects tar-pax -Wno-portability])
commit dd87f6bf89e5e92918fb15265c5861d2e817286e
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed Aug 5 12:41:57 2020 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Wed Aug 5 12:41:57 2020 +0200

    Don't update modified status after saving to storage fails
    
    Otherwise client gets a notification that document is unmodified.
    This should not happen, as the document in the storage has not been updated
    and so it should be considered as modified until saving to storage succeeds.

diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 262abe6ab..3d69511f6 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -894,6 +894,12 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
         StringTokenizer stateTokens(tokens[1], "=", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
         if (stateTokens.count() == 2 && stateTokens[0] == ".uno:ModifiedStatus")
         {
+            // When the document is saved internally, but saving to storage failed,
+            // don't update the client's modified status
+            // (otherwise client thinks document is unmodified b/c saving was successful)
+            if (!docBroker->isLastStorageSaveSuccessful())
+                return false;
+
             docBroker->setModified(stateTokens[1] == "true");
         }
         else
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 72777c6c0..3c3ca28bc 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -153,6 +153,7 @@ DocumentBroker::DocumentBroker(const std::string& uri,
     _docId(Util::encodeId(DocBrokerId++, 3)),
     _cacheRoot(getCachePath(uriPublic.toString())),
     _documentChangedInStorage(false),
+    _lastStorageSaveSuccessful(true),
     _lastSaveTime(std::chrono::steady_clock::now()),
     _lastSaveRequestTime(std::chrono::steady_clock::now() - std::chrono::milliseconds(COMMAND_TIMEOUT_MS)),
     _markToDestroy(false),
@@ -832,6 +833,7 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId,
 
     assert(_storage && _tileCache);
     StorageBase::SaveResult storageSaveResult = _storage->saveLocalFileToStorage(auth, saveAsPath, saveAsFilename);
+    _lastStorageSaveSuccessful = storageSaveResult.getResult() == StorageBase::SaveResult::OK;
     if (storageSaveResult.getResult() == StorageBase::SaveResult::OK)
     {
         if (!isSaveAs)
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index e0a3480e7..70a6bfb27 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -241,6 +241,8 @@ public:
 
     bool isDocumentChangedInStorage() { return _documentChangedInStorage; }
 
+    bool isLastStorageSaveSuccessful() { return _lastStorageSaveSuccessful; }
+
     /// Save the document to Storage if it needs persisting.
     bool saveToStorage(const std::string& sesionId, bool success, const std::string& result = "", bool force = false);
 
@@ -430,6 +432,9 @@ private:
     /// for user's command to act.
     bool _documentChangedInStorage;
 
+    /// Indicates whether the last saveToStorage operation was successful.
+    bool _lastStorageSaveSuccessful;
+
     /// The last time we tried saving, regardless of whether the
     /// document was modified and saved or not.
     std::chrono::steady_clock::time_point _lastSaveTime;


More information about the Libreoffice-commits mailing list