[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Apr 10 17:15:36 UTC 2016


 loolwsd/DocumentBroker.cpp |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit e85d726c6cf0a2eb73ac6562688935ca60cea0c7
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Apr 10 12:30:33 2016 -0400

    loolwsd: use the first valid session for auto-saving
    
    Change-Id: I3d860c9f91de56f84ae93dc93688cd4898128107
    Reviewed-on: https://gerrit.libreoffice.org/23963
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 862b298..3df2254 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -174,7 +174,22 @@ void DocumentBroker::autoSave()
             Log::info("Auto-save triggered for doc [" + _docKey + "].");
 
             // Any session can be used to save.
-            _wsSessions.begin()->second->getQueue()->put("uno .uno:Save");
+            bool sent = false;
+            for (auto& sessionIt: _wsSessions)
+            {
+                auto queue = sessionIt.second->getQueue();
+                if (queue)
+                {
+                    queue->put("uno .uno:Save");
+                    sent = true;
+                    break;
+                }
+            }
+
+            if (!sent)
+            {
+                Log::error("Failed to save doc [" + _docKey + "]: No valid sessions.");
+            }
         }
     }
 }


More information about the Libreoffice-commits mailing list