[Libreoffice-commits] online.git: kit/ChildSession.hpp

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 6 08:30:22 UTC 2019


 kit/ChildSession.hpp |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit f2d017a74aba4120d7e174e20c442f0135db6c50
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Thu Dec 5 22:09:22 2019 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Dec 6 09:30:04 2019 +0100

    android: Fix crash on the 2nd editing start.
    
    The failing scenario was reproducible on my old phone:
    
    * start editing the document from the shell
    * add a word
    * leave the editing using the '<' in the top left
    * start editing the document again => boom!
    
    In the normali, non-crashing case, the order of destruction is that
    ~ChildSession is called first (and calls ChildSession::disconnect() that
    consequently calls Document::onUnload() via _docManager->onUnLoad(...).
    The Document::onUnload() then deregisters callbacks and all is fine.
    
    The in the above described crashing case, the Document is destroyed
    before ChildSession and calls resetDocManager() for all sessions.
    Before this patch, this meant that the _docManager was set to nullptr,
    leading to situation that later, in the ~ChildSession, the call of
    onUnload() was avoided, the callbacks were not unregistered, and later,
    on the next document load, the app crashed because it called stale
    callbacks.
    
    I suspect the change might be useful even for the non-mobile case, but
    not 100% sure, so rather do it MOBILEAPP-only.
    
    Change-Id: I279a160ccaab3080e84fe0437ed72684331b6e13
    Reviewed-on: https://gerrit.libreoffice.org/84588
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/kit/ChildSession.hpp b/kit/ChildSession.hpp
index 8404bcddc..de01fce8e 100644
--- a/kit/ChildSession.hpp
+++ b/kit/ChildSession.hpp
@@ -237,6 +237,11 @@ public:
 
     void resetDocManager()
     {
+#if MOBILEAPP
+        // I suspect this might be useful even for the non-mobile case, but
+        // not 100% sure, so rather do it mobile-only for now
+        disconnect();
+#endif
         _docManager = nullptr;
     }
 


More information about the Libreoffice-commits mailing list