wsd/DocumentBroker.cpp | 10 +++++++--- wsd/DocumentBroker.hpp | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-)
New commits: commit 1e1f23716c9ee3ce880d1d927945386cf5400293 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Thu Apr 6 13:49:44 2017 -0400 wsd: don't take reference to session member being destroyed Change-Id: I0074f4557018feb47a7a2a95a3fca238407a0023 Reviewed-on: https://gerrit.libreoffice.org/36227 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index 9550dfd2..eb53f195 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -516,7 +516,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s return true; } -bool DocumentBroker::saveToStorage(const std::string& sessionId, +bool DocumentBroker::saveToStorage(const std::string sessionId, bool success, const std::string& result) { assertCorrectThread(); @@ -817,7 +817,7 @@ size_t DocumentBroker::addSession(const std::shared_ptr<ClientSession>& session) return count; } -size_t DocumentBroker::removeSession(const std::string& id, bool destroyIfLast) +size_t DocumentBroker::removeSession(const std::string id, bool destroyIfLast) { assertCorrectThread(); @@ -840,7 +840,7 @@ size_t DocumentBroker::removeSession(const std::string& id, bool destroyIfLast) return _sessions.size(); } -size_t DocumentBroker::removeSessionInternal(const std::string& id) +size_t DocumentBroker::removeSessionInternal(const std::string id) { assertCorrectThread(); try @@ -853,6 +853,10 @@ size_t DocumentBroker::removeSessionInternal(const std::string& id) LOOLWSD::dumpEndSessionTrace(getJailId(), id, _uriOrig); const auto readonly = (it->second ? it->second->isReadOnly() : false); + + //FIXME: We might be called from the session we are removing, + //FIXME: and if this is the last/only reference, we destroy it. + //FIXME: Should flag and remove from the poll thread. _sessions.erase(it); const auto count = _sessions.size(); diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp index c8758ba9..88fa2b6e 100644 --- a/wsd/DocumentBroker.hpp +++ b/wsd/DocumentBroker.hpp @@ -233,7 +233,7 @@ public: void setLoaded(); /// Save the document to Storage if it needs persisting. - bool saveToStorage(const std::string& sesionId, bool success, const std::string& result = ""); + bool saveToStorage(const std::string sesionId, bool success, const std::string& result = ""); bool isModified() const { return _isModified; } void setModified(const bool value); @@ -265,7 +265,7 @@ public: size_t addSession(const std::shared_ptr<ClientSession>& session); /// Removes a session by ID. Returns the new number of sessions. - size_t removeSession(const std::string& id, bool destroyIfLast = false); + size_t removeSession(const std::string id, bool destroyIfLast = false); /// Add a callback to be invoked in our polling thread. void addCallback(SocketPoll::CallbackFn fn); @@ -342,7 +342,7 @@ private: bool saveToStorageInternal(const std::string& sesionId, bool success, const std::string& result = ""); /// Removes a session by ID. Returns the new number of sessions. - size_t removeSessionInternal(const std::string& id); + size_t removeSessionInternal(const std::string id); /// Forward a message from child session to its respective client session. bool forwardToClient(const std::shared_ptr<Message>& payload); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits