8

Anyone able to help me out with this crash? It happens intermittently when switching back and forth between some UIWebView instances while they are loading.

The crash is often slightly different, but it's always a crash of the "WebThread" with a similar stack trace.

Here's the relevant parts of two crashes:

Date/Time:       2011-11-08 14:29:01.165 -0500
OS Version:      iPhone OS 5.0 (9A334)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000006
Crashed Thread:  4

Thread 4 name:  WebThread
Thread 4 Crashed:
0   ???                             0x00000006 0 + 6
1   WebCore                         0x32a36154 -[QuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:] + 72
2   QuickLook                       0x30bee2c2 -[QLThreadInvoker connectionDidReceiveDataLengthReceived:] + 90
3   CoreFoundation                  0x3537a226 -[NSObject performSelector:withObject:] + 38
4   Foundation                      0x32ce2752 __NSThreadPerformPerform + 346
5   CoreFoundation                  0x353efafe __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 10
6   CoreFoundation                  0x353ef2ca __CFRunLoopDoSources0 + 210
7   CoreFoundation                  0x353ee070 __CFRunLoopRun + 648
8   CoreFoundation                  0x353714d8 CFRunLoopRunSpecific + 296
9   CoreFoundation                  0x353713a0 CFRunLoopRunInMode + 100
10  WebCore                         0x324c912a _ZL12RunWebThreadPv + 398
11  libsystem_c.dylib               0x35ba1c18 _pthread_start + 316
12  libsystem_c.dylib               0x35ba1ad4 thread_start + 4
Date/Time:       2011-11-08 15:09:01.410 -0500
OS Version:      iPhone OS 5.0 (9A334)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000034
Crashed Thread:  4

Thread 4 name:  WebThread
Thread 4 Crashed:
0   ???                             0x00000034 0 + 52
1   CoreFoundation                  0x3537a226 -[NSObject performSelector:withObject:] + 38
2   Foundation                      0x32ce2752 __NSThreadPerformPerform + 346
3   CoreFoundation                  0x353efafe __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 10
4   CoreFoundation                  0x353ef2ca __CFRunLoopDoSources0 + 210
5   CoreFoundation                  0x353ee070 __CFRunLoopRun + 648
6   CoreFoundation                  0x353714d8 CFRunLoopRunSpecific + 296
7   CoreFoundation                  0x353713a0 CFRunLoopRunInMode + 100
8   WebCore                         0x324c912a _ZL12RunWebThreadPv + 398
9   libsystem_c.dylib               0x35ba1c18 _pthread_start + 316
10  libsystem_c.dylib               0x35ba1ad4 thread_start + 4
Steve
  • 572
  • 1
  • 5
  • 13

3 Answers3

7

I see that you have iOs 5.0. Are the files that you're loading Office documents (docx, xls)?

If so, then your case is the same as mine. This problem reproduces only on systems with 5.0 (iPad and iPad 2 here), and happens when you try to stop UIWebView object before it finishes loading the file. Whether it's by calling stopLoading or loadRequest

This doesn't happen with txt files.

And if it does, it originates in WebThread starting from line:

#1  0x34912158 in -[QuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:] ()

and jumping to some random pointers like:

#0  0x00000010 in 0x00000010 ()
Dharmesh Dhorajiya
  • 3,976
  • 9
  • 30
  • 39
Yoi-Nami-Ra
  • 126
  • 4
  • 1
    Yep, that's exactly what I'm seeing, and I also noticed from more testing that it is happening only with Office documents. Do you know if this bug has been submitted to Apple yet? – Steve Dec 22 '11 at 20:34
  • 2
    I reported this as a bug to Apple and they said it was a known issue that they are working on. Hopefully it'll be fixed when iOS 5.1 goes live. – Steve Feb 15 '12 at 21:02
  • What's your bug url link in apple bug track system? – jianhua Apr 24 '12 at 02:44
  • Whether this bug is fixed in iOS 5.1 or iOS 6.0 ?? Can you provide the link which you have reported as bug. ? – Perseus Jun 13 '12 at 09:13
  • Apple bug reports are not open to the public. They can only be viewed by apple and the developer account that created the bug report. My bug report was closed as a duplicate. The state of the bug report that it's a duplicate of is still listed as Open, but that is all I can see. I cannot view the bug report because it was not created by me. – Steve Jun 26 '12 at 20:09
  • Bug is not fixed in iOS 5.1, seems to be fixed in iOS 6 – jjxtra Aug 22 '12 at 21:34
  • This bug is starting to appear again in IOS 14!! – Mohamed Salah Aug 15 '20 at 10:37
4

To expand on @K1w1Geek's answer, the problem may be that the user is closing the web view just before it tries to send a delegate callback and it crashes because it doesn't exist. This doesn't necessarily have to be related to loading a particular document type because I'm experiencing this crash just navigating a Salesforce website.

So if you have a close button, try to stop loading and set the delegate to nil before closing:

- (IBAction)btnCloseWebviewTap:(id)sender{
    [_webView stopLoading];
    _webView.delegate = nil;
    [self dismissViewControllerAnimated:YES completion:nil];
}
Travis M.
  • 10,930
  • 1
  • 56
  • 72
2

Check that your UIWebViewDelegate delegate is still valid (ie. not released) if your UIWebView is in the background. This problem may be caused by the webview trying to call your delegate with

- (void)webViewDidFinishLoad:(UIWebView *)webView;

in the background after loading has completed.

K1w1Geek
  • 605
  • 5
  • 5
  • Yes I've checked to make sure this isn't the problem. My delegates either always stick around or I zero out the webView.delegate pointer before I release the delegate. – Steve Nov 14 '11 at 18:50
  • could you provide some source code? It's hard to say what's going on. – Piotr Nov 15 '11 at 09:35