wsd: verify that the last-editing-session can save
The last-editing-session could still be valid, but waiting disconnection, in which case the kit might have already discarded it, and so saving would fail (silently, and thereby leaving docbroker waiting for the save response). To avoid this, we always validate the last-editing-session before using, and not just when setting it. Change-Id: I60cd219d8e5a9945396110c8f8d194e87f81afba Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk> (cherry picked from commit e1fc6adbfef7ee0678c7a563fd6142c32f2da4a6)
This commit is contained in:
parent
b82b18e8c9
commit
965e5cb37d
1 changed files with 7 additions and 3 deletions
|
@ -1749,9 +1749,13 @@ bool DocumentBroker::autoSave(const bool force, const bool dontSaveIfUnmodified)
|
||||||
|
|
||||||
// Which session to use when auto saving ?
|
// Which session to use when auto saving ?
|
||||||
// Prefer the last editing view, if still valid, otherwise, find the first writable sessionId.
|
// Prefer the last editing view, if still valid, otherwise, find the first writable sessionId.
|
||||||
const std::string savingSessionId = (_sessions.find(_lastEditingSessionId) != _sessions.end())
|
// Note: a loaded view cannot be disconnecting.
|
||||||
? _lastEditingSessionId
|
const auto itLastEditingSession = _sessions.find(_lastEditingSessionId);
|
||||||
: getWriteableSessionId();
|
const std::string savingSessionId =
|
||||||
|
(itLastEditingSession != _sessions.end() && itLastEditingSession->second->isReadOnly() &&
|
||||||
|
itLastEditingSession->second->isViewLoaded())
|
||||||
|
? _lastEditingSessionId
|
||||||
|
: getWriteableSessionId();
|
||||||
|
|
||||||
// Remember the last save time, since this is the predicate.
|
// Remember the last save time, since this is the predicate.
|
||||||
LOG_TRC("Checking to autosave [" << _docKey << "] using session [" << savingSessionId << ']');
|
LOG_TRC("Checking to autosave [" << _docKey << "] using session [" << savingSessionId << ']');
|
||||||
|
|
Loading…
Reference in a new issue