[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 29 00:42:24 UTC 2019
wsd/DocumentBroker.cpp | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
New commits:
commit 8a06ad83e473e3f0b34e83a7ba4e45bebd0bdaeb
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Wed Oct 16 09:05:04 2019 -0400
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Tue Oct 29 01:42:05 2019 +0100
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.
Reviewed-on: https://gerrit.libreoffice.org/80896
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit 77cbe4e376649dee87dbe37f95a48e9bb6403a0b)
Change-Id: I03ee9c48a9d43487dd90672060870972b98fdc99
Reviewed-on: https://gerrit.libreoffice.org/81567
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 081a07c55..18568b53b 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1054,8 +1054,9 @@ bool DocumentBroker::autoSave(const bool force, const bool dontSaveIfUnmodified)
for (auto& sessionIt : _sessions)
{
// Save the document using an editable session, or first ...
- if (savingSessionId.empty() ||
- (!sessionIt.second->isReadOnly() && !sessionIt.second->inWaitDisconnected()))
+ if (savingSessionId.empty()
+ || (!sessionIt.second->isReadOnly() && sessionIt.second->isViewLoaded()
+ && !sessionIt.second->inWaitDisconnected()))
{
savingSessionId = sessionIt.second->getId();
}
@@ -1271,9 +1272,12 @@ 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() << ", IsWaitDisconnected: "
+ << it->second->inWaitDisconnected() << ", MarkToDestroy: " << _markToDestroy
+ << ", LastEditableSession: " << lastEditableSession);
const auto dontSaveIfUnmodified = !LOOLWSD::getConfigValue<bool>("per_document.always_save_on_exit", false);
More information about the Libreoffice-commits
mailing list