kit/Kit.cpp | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-)
New commits: commit c4d368149e74379a5c66eb5d468aeaa16121fc44 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Fri Dec 23 16:19:05 2016 -0500 wsd: simplify session purging Change-Id: Ied5206dc524c8ff772c175ec4c78c23b9a305a32 Reviewed-on: https://gerrit.libreoffice.org/32602 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/kit/Kit.cpp b/kit/Kit.cpp index f40b56c..92a097b 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -502,7 +502,6 @@ public: size_t purgeSessions() { std::vector<std::shared_ptr<ChildSession>> deadSessions; - size_t numRunning = 0; size_t num_sessions = 0; { std::unique_lock<std::mutex> lock(_mutex, std::defer_lock); @@ -516,35 +515,25 @@ public: // bluntly exit, no need to clean up our own data structures. Also, there is a bug that // causes the deadSessions.clear() call below to crash in some situations when the last // session is being removed. - for (auto it = _sessions.cbegin(); it != _sessions.cend(); ++it) + for (auto it = _sessions.cbegin(); it != _sessions.cend(); ) { - if (!it->second->isCloseFrame()) - numRunning++; - } - - if (numRunning > 0) - { - for (auto it = _sessions.cbegin(); it != _sessions.cend(); ) + if (it->second->isCloseFrame()) { - if (it->second->isCloseFrame()) - { - deadSessions.push_back(it->second); - it = _sessions.erase(it); - } - else - { - ++it; - } + deadSessions.push_back(it->second); + it = _sessions.erase(it); + } + else + { + ++it; } } num_sessions = _sessions.size(); - } - - if (numRunning == 0) - { - LOG_INF("No more sessions, exiting bluntly"); - std::_Exit(Application::EXIT_OK); + if (num_sessions == 0) + { + LOG_INF("No more sessions, exiting bluntly"); + std::_Exit(Application::EXIT_OK); + } } // Don't destroy sessions while holding our lock. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits