Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BNCDeviceInfo Crashes On Background Thread #516

Closed
brianmichel opened this issue Dec 5, 2016 · 1 comment
Closed

BNCDeviceInfo Crashes On Background Thread #516

brianmichel opened this issue Dec 5, 2016 · 1 comment

Comments

@brianmichel
Copy link
Contributor

When the Branch SDK (by way of the Segment SDK) attempts to create a BNCDeviceInfo instance a WebKit crash is emitted as the BNCDeviceInfo class attempts to execute Javascript on a background thread, which is not allowed with UIWebView. A crash similar to the following is emitted:

* thread #10: tid = 0x7aa758, 0x000000010cf17b2d WebCore`WebCore::FloatingPointEnvironment::saveMainThreadEnvironment() + 45, queue = 'io.segment.analytics', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
  * frame #0: 0x000000010cf17b2d WebCore`WebCore::FloatingPointEnvironment::saveMainThreadEnvironment() + 45
    frame #1: 0x000000010db6ad79 WebCore`StartWebThread() + 489
    frame #2: 0x0000000108f30cfc libsystem_pthread.dylib`__pthread_once_handler + 65
    frame #3: 0x0000000108f1db41 libsystem_platform.dylib`_os_once + 36
    frame #4: 0x0000000108f30c9b libsystem_pthread.dylib`pthread_once + 57
    frame #5: 0x000000010ca0c9cb WebKitLegacy`+[WebView(WebPrivate) enableWebThread] + 267
    frame #6: 0x000000010ca09fa4 WebKitLegacy`WebKitInitialize + 52
    frame #7: 0x000000010575d371 UIKit`___UIApplicationLoadWebKit_block_invoke + 217
    frame #8: 0x0000000108b810cd libdispatch.dylib`_dispatch_client_callout + 8
    frame #9: 0x0000000108b661fc libdispatch.dylib`dispatch_once_f + 501
    frame #10: 0x0000000107614efa libobjc.A.dylib`CALLING_SOME_+initialize_METHOD + 19
    frame #11: 0x0000000107615126 libobjc.A.dylib`_class_initialize + 554
    frame #12: 0x000000010761bc1d libobjc.A.dylib`lookUpImpOrForward + 176
    frame #13: 0x000000010762b554 libobjc.A.dylib`_objc_msgSend_uncached + 68
    frame #14: 0x0000000104211560 Branch`-[BNCDeviceInfo init](self=0x00006100000d4890, _cmd="init") + 2608 at BNCDeviceInfo.m:88

The BNCDeviceInfo object should check whether or not it is on the main thread before running the UIWebView code, if it is not, it should dispatch synchronously onto the main thread to configure that property.

@E-B-Smith
Copy link
Contributor

Patch added by @brianmichel in path #517. Thanks Brian!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants