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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Jan 21 07:44:21 PST 2016


 loolwsd/LOOLKit.cpp |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 54d5138537135c4dbf7f8b76b0de40e8be4e330e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Tue Jan 19 19:38:13 2016 -0500

    loolwsd: proper destruction of LibreOfficeKit instance
    
    Change-Id: If39b0d534eb93044383766a51f26faac398c834e
    Reviewed-on: https://gerrit.libreoffice.org/21673
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index a010383..0883b48 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -784,9 +784,8 @@ void lokit_main(const std::string &loSubPath, const std::string& jailId, const s
                     ("/" + loSubPath + "/program");
 #endif
 
-    std::unique_ptr<LibreOfficeKit> loKit(lok_init_2(instdir_path.c_str(), "file:///user"));
-
-    if (!loKit)
+    LibreOfficeKit* loKit(lok_init_2(instdir_path.c_str(), "file:///user"));
+    if (loKit == nullptr)
     {
         Log::error("Error: LibreOfficeKit initialization failed. Exiting.");
         exit(-1);
@@ -890,7 +889,7 @@ void lokit_main(const std::string &loSubPath, const std::string& jailId, const s
                         Log::debug("Thread request for session [" + sessionId + "], url: [" + url + "].");
                         auto it = _documents.lower_bound(url);
                         if (it == _documents.end())
-                            it = _documents.emplace_hint(it, url, std::make_shared<Document>(loKit.get(), jailId, url));
+                            it = _documents.emplace_hint(it, url, std::make_shared<Document>(loKit, jailId, url));
 
                         it->second->createSession(sessionId, intSessionId);
                         aResponse += "ok \r\n";
@@ -925,11 +924,12 @@ void lokit_main(const std::string &loSubPath, const std::string& jailId, const s
         TerminationState = LOOLState::LOOL_ABNORMAL;
     }
 
+    Log::debug("Destroying documents.");
     _documents.clear();
 
     // Destroy LibreOfficeKit
-    loKit->pClass->destroy(loKit.get());
-    loKit.release();
+    Log::debug("Destroying LibreOfficeKit.");
+    loKit->pClass->destroy(loKit);
 
     Log::info("Process [" + process_name + "] finished.");
 }


More information about the Libreoffice-commits mailing list