[Libreoffice-commits] online.git: ios/ios.h ios/ios.mm kit/Kit.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Feb 26 12:08:28 UTC 2019


 ios/ios.h   |    4 +---
 ios/ios.mm  |    2 +-
 kit/Kit.cpp |    2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 76058ac270904228f72584b517344147249dc6d2
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Feb 26 14:02:26 2019 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Feb 26 14:07:59 2019 +0200

    Fix crash in iOS app: Just use a raw pointer as the lok_document hack
    
    The lok_document pointer will only be used when it is valid anyway.
    Fixes a crash when you open a second document after closing the first.
    
    Change-Id: I362db282e4eccf419b56bf790ea58181594ab0fe

diff --git a/ios/ios.h b/ios/ios.h
index 91c04fd75..f73a5c5fb 100644
--- a/ios/ios.h
+++ b/ios/ios.h
@@ -7,11 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <memory>
-
 #include <LibreOfficeKit/LibreOfficeKit.hxx>
 
 extern int loolwsd_server_socket_fd;
-extern std::shared_ptr<lok::Document> lok_document;
+extern lok::Document *lok_document;
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ios/ios.mm b/ios/ios.mm
index 754d6c3c4..17860c854 100644
--- a/ios/ios.mm
+++ b/ios/ios.mm
@@ -18,6 +18,6 @@ extern "C" {
 }
 
 int loolwsd_server_socket_fd = -1;
-std::shared_ptr<lok::Document> lok_document;
+lok::Document *lok_document;
 
 // vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 00bf5ec8a..7bdb2cd78 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1678,7 +1678,7 @@ private:
 #ifdef IOS
             // The iOS app (and the Android one) has max one document open at a time, so we can keep
             // a pointer to it in a global.
-            lok_document = _loKitDocument;
+            lok_document = _loKitDocument.get();
 #endif
             if (!_loKitDocument || !_loKitDocument->get())
             {


More information about the Libreoffice-commits mailing list