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

Henry Castro hcastro at collabora.com
Wed Feb 3 00:08:27 UTC 2016


 loolwsd/LOOLKit.cpp |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

New commits:
commit 647d7c778390625798dd83f470ac307d6e59803d
Author: Henry Castro <hcastro at collabora.com>
Date:   Tue Feb 2 20:07:15 2016 -0400

    loolwsd: first, establish pipe connection

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index f57c7ad..763e21d 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -530,13 +530,7 @@ void lokit_main(const std::string &loSubPath, const std::string& jailId, const s
 #else
                     ("/" + loSubPath + "/program");
 #endif
-
-    LibreOfficeKit* loKit(lok_init_2(instdir_path.c_str(), "file:///user"));
-    if (loKit == nullptr)
-    {
-        Log::error("Error: LibreOfficeKit initialization failed. Exiting.");
-        exit(Application::EXIT_SOFTWARE);
-    }
+    LibreOfficeKit* loKit = nullptr;
 
     try
     {
@@ -555,6 +549,13 @@ void lokit_main(const std::string &loSubPath, const std::string& jailId, const s
             exit(Application::EXIT_SOFTWARE);
         }
 
+        loKit = lok_init_2(instdir_path.c_str(), "file:///user");
+        if (loKit == nullptr)
+        {
+            Log::error("Error: LibreOfficeKit initialization failed. Exiting.");
+            exit(Application::EXIT_SOFTWARE);
+        }
+
         Log::info("loolkit [" + std::to_string(Process::id()) + "] is ready.");
 
         std::string aResponse;
@@ -677,7 +678,8 @@ void lokit_main(const std::string &loSubPath, const std::string& jailId, const s
 
     // Destroy LibreOfficeKit
     Log::debug("Destroying LibreOfficeKit.");
-    loKit->pClass->destroy(loKit);
+    if (loKit)
+        loKit->pClass->destroy(loKit);
 
     Log::info("Process [" + process_name + "] finished.");
 }


More information about the Libreoffice-commits mailing list