Skip to content

Commit f2d1421

Browse files
deepshah7Mike Chen
authored andcommitted
Fixing a crash in iOS 9.3.5 when we have a layer with WebView getting deallocated (cocos2d#20285)
* 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 254c845 commit f2d1421

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cocos/ui/UIWebViewImpl-ios.mm

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

8989

9090
@interface UIWebViewWrapper () <WKUIDelegate, WKNavigationDelegate>
91-
@property(nonatomic, retain) WKWebView *wkWebView;
91+
@property(nonatomic) WKWebView *wkWebView;
9292

9393
@property(nonatomic, copy) NSString *jsScheme;
9494
@end
@@ -124,7 +124,7 @@ - (void)dealloc {
124124

125125
- (void)setupWebView {
126126
if (!self.wkWebView) {
127-
self.wkWebView = [[[WKWebView alloc] init] autorelease];
127+
self.wkWebView = [[WKWebView alloc] init];
128128
self.wkWebView.UIDelegate = self;
129129
self.wkWebView.navigationDelegate = self;
130130
}

0 commit comments

Comments
 (0)