[Libreoffice-commits] online.git: loolwsd/DocumentBroker.hpp loolwsd/LOOLKit.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Apr 4 04:09:11 UTC 2016


 loolwsd/DocumentBroker.hpp |    4 ++--
 loolwsd/LOOLKit.cpp        |   18 ++++++++++++++----
 2 files changed, 16 insertions(+), 6 deletions(-)

New commits:
commit ed1790d7a30933860010a6c24083229b2cac06f0
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Apr 3 23:26:06 2016 -0400

    loolwsd: kit destruction improvements
    
    Change-Id: Ia491e5dc85e13eda12bb47690a8d335ad0917468
    Reviewed-on: https://gerrit.libreoffice.org/23791
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp
index 458090f..622eab5 100644
--- a/loolwsd/DocumentBroker.hpp
+++ b/loolwsd/DocumentBroker.hpp
@@ -69,7 +69,7 @@ public:
     ~ChildProcess()
     {
         Log::info("~ChildProcess dtor [" + std::to_string(_pid) + "].");
-        close(true);
+        close(false);
     }
 
     void close(const bool rude)
@@ -77,7 +77,7 @@ public:
         Log::info("Closing child [" + std::to_string(_pid) + "].");
         if (_pid != -1)
         {
-            if (kill(_pid, SIGINT) != 0 && rude && kill(_pid, 0) != 0)
+            if (rude && kill(_pid, SIGINT) != 0 && kill(_pid, 0) != 0)
             {
                 Log::error("Cannot terminate lokit [" + std::to_string(_pid) + "]. Abandoning.");
             }
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 9b012d9..e3fd8ce 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -398,11 +398,20 @@ public:
         // Destroy all connections and views.
         _connections.clear();
 
-        // TODO. check what is happening when destroying lokit document
+        // TODO. check what is happening when destroying lokit document,
+        // often it blows up.
         // Destroy the document.
         if (_loKitDocument != nullptr)
         {
-            _loKitDocument->pClass->destroy(_loKitDocument);
+            try
+            {
+                _loKitDocument->pClass->destroy(_loKitDocument);
+            }
+            catch (const std::exception& exc)
+            {
+                Log::error() << "Document::~Document: " << exc.what()
+                             << Log::end;
+            }
         }
     }
 
@@ -670,7 +679,10 @@ private:
         auto sessionLock = session->getLock();
         std::unique_lock<std::mutex> lock(_mutex);
 
+        Log::info("Session " + sessionId + " is unloading. Erasing connection.");
+        _connections.erase(it);
         --_clientViews;
+        Log::info("Session " + sessionId + " is unloading. " + std::to_string(_clientViews) + " views will remain.");
 
         std::ostringstream message;
         message << "rmview" << " "
@@ -679,8 +691,6 @@ private:
                 << "\n";
         IoUtil::writeFIFO(WriterNotify, message.str());
 
-        Log::info("Session " + sessionId + " is unloading. " + std::to_string(_clientViews) + " views will remain.");
-
         if (_multiView && _loKitDocument)
         {
             Log::info() << "Document [" << _url << "] session ["


More information about the Libreoffice-commits mailing list