Skip to content

Commit

Permalink
Fixing a crash in iOS 9.3.5 when we have a layer with WebView getting…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
minggo committed Nov 14, 2019
1 parent 5688852 commit 3a36e2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cocos/ui/UIWebView/UIWebViewImpl-ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ - (void)setScalesPageToFit:(const bool)scalesPageToFit;


@interface UIWebViewWrapper () <WKUIDelegate, WKNavigationDelegate>
@property(nonatomic, retain) WKWebView *wkWebView;
@property(nonatomic) WKWebView *wkWebView;

@property(nonatomic, copy) NSString *jsScheme;
@end
Expand Down Expand Up @@ -118,7 +118,7 @@ - (void)dealloc {

- (void)setupWebView {
if (!self.wkWebView) {
self.wkWebView = [[[WKWebView alloc] init] autorelease];
self.wkWebView = [[WKWebView alloc] init];
self.wkWebView.UIDelegate = self;
self.wkWebView.navigationDelegate = self;
}
Expand Down

1 comment on commit 3a36e2d

@uranium2818322192
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can confirm that the crash still exits on ios 9.3.5 as well as 9.3.6, did not spot any difference on the crash after this particular commit.

Please sign in to comment.