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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Mar 13 04:09:57 UTC 2017


 wsd/DocumentBroker.cpp |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit c939eeab6837dd4151815da597acea6e6b36dd99
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Mar 12 14:13:48 2017 -0400

    wsd: remove the last session immediately if no saving needed
    
    Change-Id: I509c7a83f16caf0d55fcb6af9c7ce707b7a0e389
    Reviewed-on: https://gerrit.libreoffice.org/35115
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index fa8ba94..aacdfae 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -601,7 +601,7 @@ bool DocumentBroker::autoSave(const bool force)
     {
         // Nothing to do.
         LOG_TRC("Nothing to autosave [" << _docKey << "].");
-        return true;
+        return false;
     }
 
     // Remember the last save time, since this is the predicate.
@@ -779,9 +779,7 @@ size_t DocumentBroker::removeSession(const std::string& id, bool destroyIfLast)
         LOG_INF("Removing session [" << id << "] on docKey [" << _docKey <<
                 "]. Have " << _sessions.size() << " sessions.");
 
-        if (_lastEditableSession)
-            autoSave(true);
-        else
+        if (!_lastEditableSession || !autoSave(true))
             return removeSessionInternal(id);
     }
     catch (const std::exception& ex)
@@ -797,7 +795,8 @@ size_t DocumentBroker::removeSessionInternal(const std::string& id)
     try
     {
         // remove also from the _newSessions
-        _newSessions.erase(std::remove_if(_newSessions.begin(), _newSessions.end(), [&id](NewSession& newSession) { return newSession._session->getId() == id; }),
+        _newSessions.erase(std::remove_if(_newSessions.begin(), _newSessions.end(),
+                                          [&id](NewSession& newSession) { return newSession._session->getId() == id; }),
                            _newSessions.end());
 
         Admin::instance().rmDoc(_docKey, id);


More information about the Libreoffice-commits mailing list