[Libreoffice-commits] online.git: ios/Mobile
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 7 14:01:40 UTC 2020
ios/Mobile/CODocument.mm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
New commits:
commit ea4a6575731fb261d0557feba668fa087d5764b9
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue Jul 7 16:13:25 2020 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Tue Jul 7 16:01:19 2020 +0200
Use a separate temp directory for each document during the iOS app lifetime
This prevents an assertion failure when you quickly open the same
document again after closing it.
Change-Id: I26b8c53d57bd1d33f0473a3c5a332ec02c37455d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98263
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tor Lillqvist <tml at collabora.com>
diff --git a/ios/Mobile/CODocument.mm b/ios/Mobile/CODocument.mm
index c12bd2e91..d25c7ded7 100644
--- a/ios/Mobile/CODocument.mm
+++ b/ios/Mobile/CODocument.mm
@@ -56,7 +56,14 @@ static std::atomic<unsigned> appDocIdCounter(1);
fakeClientFd = fakeSocketSocket();
- copyFileURL = [[[NSFileManager defaultManager] temporaryDirectory] URLByAppendingPathComponent:[[[self fileURL] path] lastPathComponent]];
+ appDocId = appDocIdCounter++;
+ NSURL *copyFileDirectory = [[NSFileManager.defaultManager temporaryDirectory] URLByAppendingPathComponent:[NSString stringWithFormat:@"%d", appDocId]];
+ if (![NSFileManager.defaultManager createDirectoryAtURL:copyFileDirectory withIntermediateDirectories:YES attributes:nil error:nil]) {
+ LOG_ERR("Could not create directory " << [[copyFileDirectory path] UTF8String]);
+ return NO;
+ }
+
+ copyFileURL = [copyFileDirectory URLByAppendingPathComponent:[[[self fileURL] path] lastPathComponent]];
NSError *error;
[[NSFileManager defaultManager] removeItemAtURL:copyFileURL error:nil];
@@ -66,7 +73,6 @@ static std::atomic<unsigned> appDocIdCounter(1);
NSURL *url = [[NSBundle mainBundle] URLForResource:@"loleaflet" withExtension:@"html"];
NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
- appDocId = appDocIdCounter++;
allocateDocumentDataForMobileAppDocId(appDocId).coDocument = self;
components.queryItems = @[ [NSURLQueryItem queryItemWithName:@"file_path" value:[copyFileURL absoluteString]],
[NSURLQueryItem queryItemWithName:@"closebutton" value:@"1"],
More information about the Libreoffice-commits
mailing list