[Libreoffice-commits] online.git: ios/Mobile
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Apr 26 15:04:38 UTC 2019
ios/Mobile/Document.h | 2 +-
ios/Mobile/DocumentViewController.mm | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
New commits:
commit f21665f2ac2514e2aab49785f09805c4f7dcca19
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Fri Apr 26 17:52:33 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Apr 26 18:04:10 2019 +0300
tdf#124981: Fix a few object leaks
The pointer to the DocumentViewController object in the Document class
can be a weak property. This avoids a circular reference.
When the DocumentViewController is being dismissed, remove the script
message handlers and remove the view from its superview. Also, set the
webView property to nil.
diff --git a/ios/Mobile/Document.h b/ios/Mobile/Document.h
index 004bcce0b..a843dc7f1 100644
--- a/ios/Mobile/Document.h
+++ b/ios/Mobile/Document.h
@@ -20,7 +20,7 @@
int fakeClientFd;
}
- at property (strong) DocumentViewController *viewController;
+ at property (weak) DocumentViewController *viewController;
- (void)send2JS:(const char*)buffer length:(int)length;
diff --git a/ios/Mobile/DocumentViewController.mm b/ios/Mobile/DocumentViewController.mm
index 1d70b2882..76e64d0d8 100644
--- a/ios/Mobile/DocumentViewController.mm
+++ b/ios/Mobile/DocumentViewController.mm
@@ -84,6 +84,12 @@
[self dismissViewControllerAnimated:YES completion:^ {
[self.document closeWithCompletionHandler:^(BOOL success){
LOG_TRC("close completion handler gets " << (success?"YES":"NO"));
+ [self.webView.configuration.userContentController removeScriptMessageHandlerForName:@"debug"];
+ [self.webView.configuration.userContentController removeScriptMessageHandlerForName:@"lool"];
+ [self.webView.configuration.userContentController removeScriptMessageHandlerForName:@"error"];
+ self.webView.configuration.userContentController = nil;
+ [self.webView removeFromSuperview];
+ self.webView = nil;
}];
}];
}
More information about the Libreoffice-commits
mailing list