loolwsd: for consistency always remove edit lock before taking it

Change-Id: Id24d6737fc3af77097058b28a77d6ca2d757cb9e
Reviewed-on: https://gerrit.libreoffice.org/23965
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-04-10 13:06:35 -04:00 committed by Ashod Nakashian
parent 60531e7def
commit 85641d934e

View file

@ -239,17 +239,18 @@ void DocumentBroker::addWSSession(const std::string id, std::shared_ptr<MasterPr
void DocumentBroker::removeWSSession(const std::string id)
{
std::lock_guard<std::mutex> 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();