wsd/ClientSession.cpp |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit f32c1f2febf7d3a3bdf0c7b0afa70d69a24cc761
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Mar 18 09:20:31 2020 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Mar 18 15:17:02 2020 +0100

    wsd: improve lifecycle in ClientSession::onDisconnect()
    
    Once unit-bad-doc-load completes (with success in exitTest()), sometimes
    we have an error during shutdown.
    
    The reason seems to be that ClientSession::onDisconnect() calls
    DocumentBroker::removeSession(), which may delete the ClientSession, so
    by time time isCloseFrame() is called, we have trouble.
    
    Fix the problem by keeping a reference to self before calling
    removeSession().
    
    Change-Id: If5b409822563ba5a45d453329516671065d8f054
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90681
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 29e420dad..f336eeec0 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -1638,6 +1638,9 @@ void ClientSession::onDisconnect()
     docBroker->assertCorrectThread();
     const std::string docKey = docBroker->getDocKey();
 
+    // Keep self alive, so that our own dtor runs only at the end of this 
function. Without this,
+    // removeSession() may destroy us and then we can't call our own member 
functions anymore.
+    std::shared_ptr<ClientSession> session = client_from_this();
     try
     {
         // Connection terminated. Destroy session.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to