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:
parent
60531e7def
commit
85641d934e
1 changed files with 6 additions and 5 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue