ios/Mobile/Document.h | 2 +- ios/Mobile/DocumentViewController.mm | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
New commits: commit f21665f2ac2514e2aab49785f09805c4f7dcca19 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Fri Apr 26 17:52:33 2019 +0300 Commit: Tor Lillqvist <t...@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; } -@property (strong) DocumentViewController *viewController; +@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; }]; }]; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits