[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - wsd/DocumentBroker.cpp
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Sat Oct 19 18:58:59 UTC 2019
wsd/DocumentBroker.cpp | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
New commits:
commit 77cbe4e376649dee87dbe37f95a48e9bb6403a0b
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Oct 16 09:05:04 2019 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Oct 19 20:58:40 2019 +0200
wsd: save using a fully-loaded view
Using a view that hasn't finished loading
for saving the document will fail, and there
is no recovery from that (by using a loaded
view as fallback, for example).
This can happen when a new view is being loaded
while the last one is closing. We might in this
case end up using the new view to save the document
before closing it, however this will fail if
the new view hasn't loaded yet, potentially
losing some late modifications.
We avoid this by always picking a loaded view
for saving, or the first.
Change-Id: I03ee9c48a9d43487dd90672060870972b98fdc99
Reviewed-on: https://gerrit.libreoffice.org/80896
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index ed64b93ef..657ea999b 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -993,18 +993,19 @@ bool DocumentBroker::autoSave(const bool force)
// Which session to use when auto saving ?
std::string savingSessionId;
- for (auto& sessionIt : _sessions)
+ for (auto& session : _sessions)
{
- // Save the document using an editable session, or first ...
- if (savingSessionId.empty() || !sessionIt.second->isReadOnly())
+ // Save the document using an editable and loaded session, or first ...
+ if (savingSessionId.empty()
+ || (!session.second->isReadOnly() && session.second->isViewLoaded()))
{
- savingSessionId = sessionIt.second->getId();
+ savingSessionId = session.second->getId();
}
// or if any of the sessions is document owner, use that.
- if (sessionIt.second->isDocumentOwner())
+ if (session.second->isDocumentOwner())
{
- savingSessionId = sessionIt.second->getId();
+ savingSessionId = session.second->getId();
break;
}
}
@@ -1210,9 +1211,11 @@ size_t DocumentBroker::removeSession(const std::string& id)
const bool lastEditableSession = !it->second->isReadOnly() && !haveAnotherEditableSession(id);
- LOG_INF("Removing session [" << id << "] on docKey [" << _docKey <<
- "]. Have " << _sessions.size() << " sessions. markToDestroy: " << _markToDestroy <<
- ", LastEditableSession: " << lastEditableSession);
+ LOG_INF("Removing session ["
+ << id << "] on docKey [" << _docKey << "]. Have " << _sessions.size()
+ << " sessions. IsReadOnly: " << it->second->isReadOnly() << ", IsViewLoaded: "
+ << it->second->isViewLoaded() << ". markToDestroy: " << _markToDestroy
+ << ", LastEditableSession: " << lastEditableSession);
// If last editable, save and don't remove until after uploading to storage.
if (!lastEditableSession || !autoSave(isPossiblyModified()))
More information about the Libreoffice-commits
mailing list