loolwsd: proper destruction of LibreOfficeKit instance
Change-Id: If39b0d534eb93044383766a51f26faac398c834e Reviewed-on: https://gerrit.libreoffice.org/21673 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
parent
ad7509d449
commit
54d5138537
1 changed files with 6 additions and 6 deletions
|
@ -784,9 +784,8 @@ void lokit_main(const std::string &loSubPath, const std::string& jailId, const s
|
||||||
("/" + loSubPath + "/program");
|
("/" + loSubPath + "/program");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::unique_ptr<LibreOfficeKit> loKit(lok_init_2(instdir_path.c_str(), "file:///user"));
|
LibreOfficeKit* loKit(lok_init_2(instdir_path.c_str(), "file:///user"));
|
||||||
|
if (loKit == nullptr)
|
||||||
if (!loKit)
|
|
||||||
{
|
{
|
||||||
Log::error("Error: LibreOfficeKit initialization failed. Exiting.");
|
Log::error("Error: LibreOfficeKit initialization failed. Exiting.");
|
||||||
exit(-1);
|
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 + "].");
|
Log::debug("Thread request for session [" + sessionId + "], url: [" + url + "].");
|
||||||
auto it = _documents.lower_bound(url);
|
auto it = _documents.lower_bound(url);
|
||||||
if (it == _documents.end())
|
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);
|
it->second->createSession(sessionId, intSessionId);
|
||||||
aResponse += "ok \r\n";
|
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;
|
TerminationState = LOOLState::LOOL_ABNORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log::debug("Destroying documents.");
|
||||||
_documents.clear();
|
_documents.clear();
|
||||||
|
|
||||||
// Destroy LibreOfficeKit
|
// Destroy LibreOfficeKit
|
||||||
loKit->pClass->destroy(loKit.get());
|
Log::debug("Destroying LibreOfficeKit.");
|
||||||
loKit.release();
|
loKit->pClass->destroy(loKit);
|
||||||
|
|
||||||
Log::info("Process [" + process_name + "] finished.");
|
Log::info("Process [" + process_name + "] finished.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue