[Libreoffice-commits] online.git: loolwsd/LOOLKit.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Wed May 18 11:32:34 UTC 2016
loolwsd/LOOLKit.cpp | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
New commits:
commit 312b9ee6cbb9502b3b2c01790fb7e24dcc5feb69
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Wed May 18 06:55:25 2016 -0400
loolwsd: less naked pointers
Change-Id: I5f352a80a181f410c002d60b9ec5c61fb88d0cf0
Reviewed-on: https://gerrit.libreoffice.org/25095
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 c864691..528e690 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -864,7 +864,7 @@ private:
try
{
load(sessionId, uri, docPassword, renderOpts, haveDocPassword);
- if (!_loKitDocument)
+ if (!_loKitDocument || !_loKitDocument->get())
{
return nullptr;
}
@@ -876,7 +876,7 @@ private:
}
// Done loading, let the next one in (if any).
- assert(_loKitDocument && "Uninitialized lok::Document instance");
+ assert(_loKitDocument && _loKitDocument->get() && "Uninitialized lok::Document instance");
lock.lock();
++_clientViews;
--_isLoading;
@@ -918,11 +918,11 @@ private:
private:
- LibreOfficeKitDocument* load(const std::string& sessionId,
- const std::string& uri,
- const std::string& docPassword,
- const std::string& renderOpts,
- bool haveDocPassword)
+ std::shared_ptr<lok::Document> load(const std::string& sessionId,
+ const std::string& uri,
+ const std::string& docPassword,
+ const std::string& renderOpts,
+ bool haveDocPassword)
{
const unsigned intSessionId = Util::decodeId(sessionId);
const auto it = _connections.find(intSessionId);
@@ -959,7 +959,7 @@ private:
_loKitDocument = _loKit->documentLoad(uri.c_str());
Log::debug("Returned lokit::documentLoad.");
- if (!_loKitDocument)
+ if (!_loKitDocument || !_loKitDocument->get())
{
Log::error("Failed to load: " + uri + ", error: " + _loKit->getError());
@@ -1028,7 +1028,7 @@ private:
}
}
- return _loKitDocument->get();
+ return _loKitDocument;
}
private:
More information about the Libreoffice-commits
mailing list