App crashes on releasing a WKWebView with the delegate of its scrollView is assigned
| Originator: | jay.shure | ||
| Number: | rdar://18480729 | Date Originated: | 27/9/2014 |
| Status: | Closed | Resolved: | Duplicated with 18419816 |
| Product: | iOS | Product Version: | 8.0.x |
| Classification: | Bug | Reproducible: | Always |
Summary:
As the title says, if the scrollView of a WKWebView is configured with a delegate, the program will crash when trying to release the WKWebView instance.
The workaround is to clear the delegate of that scrollView before releasing the WKWebView instance.
Steps to Reproduce:
@import WebKit;
#import "AppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
WKWebView *wv = [[WKWebView alloc] initWithFrame:CGRectZero];
wv.scrollView.delegate = (id<UIScrollViewDelegate>)[NSObject new];
wv = nil;
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
Expected Results:
The app should start normally.
Actual Results:
App crashes.
Debug output:
malloc: *** error for object 0x7fd6d0f37320: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Version:
iOS 8.0
Notes:
Configuration:
All the iOS 8 Simulator, iPhone 5s with iOS 8.0.2
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!