title: EXC_BAD_ACCESS (SIGSEGV) in WebCore::UserGestureIndicator::processingUserGesture
body: <p>I have an iOS application built using a UIWebView and HTML5 websockets. The app experiences seemingly random crashes. It has occurred while a user is interacting with it and during longevity tests where no interaction between user and app occurs.</p>
  
  <p>The crash logs all have the following:</p>
  
  <pre><code>Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
  Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000
  </code></pre>
  
  <p>and the thread logs contain:</p>
  
  <pre><code>Thread XX name:  WebCore: Worker
  Thread XX Crashed:
  0   WebCore                         0x36c8c7a0 WebCore::UserGestureIndicator::processingUserGesture() + 20
  1   WebCore                         0x36d7070a WebCore::DOMTimer::DOMTimer(WebCore::ScriptExecutionContext*, WTF::PassOwnPtr&lt;WebCore::ScheduledAction&gt;, int, bool) + 74
  2   WebCore                         0x36d70616 WebCore::DOMTimer::install(WebCore::ScriptExecutionContext*, WTF::PassOwnPtr&lt;WebCore::ScheduledAction&gt;, int, bool) + 46
  3   WebCore                         0x3753ae7e WebCore::WorkerContext::setTimeout(WTF::PassOwnPtr&lt;WebCore::ScheduledAction&gt;, int) + 30
  4   WebCore                         0x3731ac02 WebCore::JSWorkerContext::setTimeout(JSC::ExecState*) + 194
  5   WebCore                         0x37318ff6 WebCore::jsWorkerContextPrototypeFunctionSetTimeout(JSC::ExecState*) + 110
  6   JavaScriptCore                  0x2fa9a1d8 llint_native_call_trampoline + 62
  7   JavaScriptCore                  0x2faa355a JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&amp;, JSC::JSValue, JSC::ArgList const&amp;) + 66
  8   WebCore                         0x36db0b16 WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) + 558
  9   WebCore                         0x36d6ebba WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector&lt;WebCore::RegisteredEventListener, 1ul, WTF::CrashOnOverflow&gt;&amp;) + 482
  10  WebCore                         0x36c6da2a WebCore::EventTarget::fireEventListeners(WebCore::Event*) + 174
  11  WebCore                         0x36e28824 WebCore::EventTarget::dispatchEvent(WTF::PassRefPtr&lt;WebCore::Event&gt;) + 60
  12  WebCore                         0x3753e596 WebCore::MessageWorkerContextTask::performTask(WebCore::ScriptExecutionContext*) + 222
  13  WebCore                         0x3753ec6e WebCore::WorkerRunLoop::runInMode(WebCore::WorkerContext*, WebCore::ModePredicate const&amp;, WebCore::WorkerRunLoop::WaitMode) + 158
  14  WebCore                         0x3753eb94 WebCore::WorkerRunLoop::run(WebCore::WorkerContext*) + 60
  15  WebCore                         0x37540d64 WebCore::WorkerThread::workerThread() + 432
  16  JavaScriptCore                  0x2fa4ba68 WTF::wtfThreadEntryPoint(void*) + 12
  17  libsystem_pthread.dylib         0x397b6c5a _pthread_body + 138
  18  libsystem_pthread.dylib         0x397b6bca _pthread_start + 98
  19  libsystem_pthread.dylib         0x397b4ccc thread_start + 4
  </code></pre>
  
  <p>I managed to catch the exception on throw, and from what I can tell it looks to be a framework bug. See attached screenshot.</p>
  
  <p><img src="https://i.stack.imgur.com/li4u0.png" alt="enter image description here"></p>
  
  <p>Most of what I've read seem to indicate that the web view is being dealloced prior to a delegate firing, but nowhere in my code do I dealloc!</p>
  
  <p>Has anyone encountered this or a similar case? Any help is much appreciated!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I have filed a bug report with Apple after contacting developer support. Their engineers confirmed this as being a bug.</p>