IOS 6 UIWebView crash

I see an intermittent failure (about 20% at startup) with the code below. If I changed a property UIWebViewto a property instead of a temp variable, i.e. Without releasing UIWebView, the accident will disappear. The same code does not crash on iOS 7.

- (void)obtainUserAgentString
{
    UIWebView *aWebview = [[UIWebView alloc] initWithFrame:CGRectZero];
    sHRUserAgentString = [aWebview stringByEvaluatingJavaScriptFromString:@"window.navigator.userAgent"];
}

There seems to be some kind of timer under the hook even after I finished with UIWebView. The accident occurs on the main stream.

* thread #1: tid = 0x123c1f, 0x038d63ca CoreFoundation`CFRelease + 26, queue = 'com.apple.main-thread, stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
frame #0: 0x038d63ca CoreFoundation`CFRelease + 26
frame #1: 0x076e2b8b WebCore`WebCore::stopSharedTimer() + 43
frame #2: 0x07894765 WebCore`WebCore::ThreadTimers::updateSharedTimer() + 37
frame #3: 0x0789f39f WebCore`WebCore::TimerBase::setNextFireTime(double) + 431
frame #4: 0x0789f15d WebCore`WebCore::TimerBase::~TimerBase() + 61
frame #5: 0x06d9a7fb WebCore`WebCore::Document::~Document() + 4427
frame #6: 0x06f84213 WebCore`WebCore::HTMLDocument::~HTMLDocument() + 19
frame #7: 0x06d9bb14 WebCore`non-virtual thunk to WebCore::Document::removedLastRef() + 20
frame #8: 0x072eee4b WebCore`WebCore::JSNodeOwner::finalize(JSC::Handle<JSC::Unknown>, void*) + 187
frame #9: 0x095000b4 JavaScriptCore`JSC::WeakBlock::sweep() + 116
frame #10: 0x095003dd JavaScriptCore`JSC::WeakSet::sweep() + 61
frame #11: 0x093856e1 JavaScriptCore`JSC::Heap::collect(JSC::Heap::SweepToggle) + 225
frame #12: 0x09387342 JavaScriptCore`JSC::Heap::collectAllGarbage() + 34
frame #13: 0x0938393a JavaScriptCore`JSC::DefaultGCActivityCallbackPlatformData::timerDidFire(__CFRunLoopTimer*, void*) + 202
frame #14: 0x03919376 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
frame #15: 0x03918e06 CoreFoundation`__CFRunLoopDoTimer + 534
frame #16: 0x03900a82 CoreFoundation`__CFRunLoopRun + 1810
frame #17: 0x038fff44 CoreFoundation`CFRunLoopRunSpecific + 276
frame #18: 0x038ffe1b CoreFoundation`CFRunLoopRunInMode + 123
frame #19: 0x04c1e7e3 GraphicsServices`GSEventRunModal + 88
frame #20: 0x04c1e668 GraphicsServices`GSEventRun + 104
frame #21: 0x0264965c UIKit`UIApplicationMain + 1211

Related question: Unknown cause of failure (when connecting CrashReport) SIGTRAP. AFNetworking?

+4
source share

All Articles