wsd/DocumentBroker.cpp |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit ed51fafecef9424a71cca73edf8bb428d835f372
Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
Date:   Wed Apr 12 21:19:51 2017 -0400

    wsd: DocBroker is Alive if not flagged to stop
    
    There is a race between creating and adding
    a DocBroker into the DocBrokers container
    and cleanupDocBrokers is invoked (on timer)
    before it had a chance to start its poll
    thread. This is exceedingly rare, but it
    has happened.
    
    We check that_stop==false flag when deciding
    isAlive such that cleanDocBrokers will
    not remove it before its thread had
    a chance to run (which would happen
    after adding it and creating the
    ClientSession).
    
    Also, no point in checking isAlive from
    the polling thread itself (of course it is
    alive).
    
    Change-Id: If54fe2b5fce0697ee0e2f38f1662c71105e29347
    Reviewed-on: https://gerrit.libreoffice.org/36500
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 3cac2e70..e0c8b05b 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -242,7 +242,7 @@ void DocumentBroker::pollThread()
 
         // If all sessions have been removed, no reason to linger.
         if ((isLoaded() || _markToDestroy) && notSaving &&
-            (_sessions.empty() || !isAlive() || idle))
+            (_sessions.empty() || idle))
         {
             LOG_INF("Terminating " << (idle ? "idle" : "dead") <<
                     " DocumentBroker for docKey [" << getDocKey() << "].");
@@ -292,8 +292,8 @@ void DocumentBroker::pollThread()
 
 bool DocumentBroker::isAlive() const
 {
-    if (_poll->isAlive())
-        return true; // Polling thread still running.
+    if (!_stop || _poll->isAlive())
+        return true; // Polling thread not started or still running.
 
     // Shouldn't have live child process outside of the polling thread.
     return _childProcess && _childProcess->isAlive();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to