From 85641d934e27eab4206f6e6c81646ea142539284 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Sun, 10 Apr 2016 13:06:35 -0400 Subject: [PATCH] loolwsd: for consistency always remove edit lock before taking it Change-Id: Id24d6737fc3af77097058b28a77d6ca2d757cb9e Reviewed-on: https://gerrit.libreoffice.org/23965 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian --- loolwsd/DocumentBroker.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp index 4551270ae..4b25e480b 100644 --- a/loolwsd/DocumentBroker.cpp +++ b/loolwsd/DocumentBroker.cpp @@ -239,17 +239,18 @@ void DocumentBroker::addWSSession(const std::string id, std::shared_ptr sessionsLock(_wsSessionsMutex); - bool bEditLock = false; + + bool haveEditLock = false; auto it = _wsSessions.find(id); if (it != _wsSessions.end()) { - if (it->second->isEditLocked()) - bEditLock = true; - + haveEditLock = it->second->isEditLocked(); + it->second->setEditLock(false); + it->second->sendTextFrame("editlock 0"); _wsSessions.erase(it); } - if (bEditLock) + if (haveEditLock) { // pass the edit lock to first session in map it = _wsSessions.begin();