Skip to content

Commit 3a36e2d

Browse files
authored
Fixing a crash in iOS 9.3.5 when we have a layer with WebView getting deallocated (#20285) (#20328)
* In case of iOS 9.3.5 when we show a web view and deallocate the layer it is trying to release memory associated with WKWebView instance, but it hadn’t retained it in the first place. This results in a crash. This commit fixes that crash. * Removing the autorelease and retain parts from the WKWebView instantiation. * Changes so that we can remove the retain from the property declaration and depend only on manual retain and release of memory <Deep>
1 parent 5688852 commit 3a36e2d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cocos/ui/UIWebView/UIWebViewImpl-ios.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ - (void)setScalesPageToFit:(const bool)scalesPageToFit;
8282

8383

8484
@interface UIWebViewWrapper () <WKUIDelegate, WKNavigationDelegate>
85-
@property(nonatomic, retain) WKWebView *wkWebView;
85+
@property(nonatomic) WKWebView *wkWebView;
8686

8787
@property(nonatomic, copy) NSString *jsScheme;
8888
@end
@@ -118,7 +118,7 @@ - (void)dealloc {
118118

119119
- (void)setupWebView {
120120
if (!self.wkWebView) {
121-
self.wkWebView = [[[WKWebView alloc] init] autorelease];
121+
self.wkWebView = [[WKWebView alloc] init];
122122
self.wkWebView.UIDelegate = self;
123123
self.wkWebView.navigationDelegate = self;
124124
}

0 commit comments

Comments
 (0)