Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

[iOS] Crash using bundled style immediately after instantiation #1014

Closed

Description

@1ec5

@DavidChouinard reports in #852 (comment) calling -[MGLMapView useBundledStyleNamed:] results in a crash in a project that links against libMapboxGL. Here’s the stack trace:

Thread 1Queue : com.apple.main-thread (serial)
#0  0x00000001093b0286 in __pthread_kill ()
#1  0x00000001093e342f in pthread_kill ()
#2  0x000000010913f19a in abort ()
#3  0x0000000108efb481 in abort_message ()
#4  0x0000000108f232f8 in default_terminate_handler() ()
#5  0x0000000108f20b01 in std::__terminate(void (*)()) ()
#6  0x0000000108f20b8e in std::terminate() ()
#7  0x00000001062fb2ba in std::__1::thread::operator=(std::__1::thread&&) [inlined] at /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread:393
#8  0x00000001062fb2b5 in mbgl::Map::start(bool) at /Users/mxn/hub/mapbox-gl-native-2/src/mbgl/map/map.cpp:154
#9  0x0000000106381f52 in -[MGLMapView setStyleURL:] at /Users/mxn/hub/mapbox-gl-native-2/platform/ios/MGLMapView.mm:179
#10 0x00000001062d869f in -[ViewController viewDidLoad] at /Users/mxn/Documents/Playroom/PeaPod/PeaPod/ViewController.m:47
#11 0x0000000107d664a0 in -[UIViewController loadViewIfRequired] ()
#12 0x0000000107d6669e in -[UIViewController view] ()
#13 0x0000000107c81bb9 in -[UIWindow addRootViewControllerViewIfPossible] ()
#14 0x0000000107c81f7f in -[UIWindow _setHidden:forced:] ()
#15 0x0000000107c8eacd in -[UIWindow makeKeyAndVisible] ()
#16 0x0000000107c31ad7 in -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] ()
#17 0x0000000107c347ee in -[UIApplication _runWithMainScene:transitionContext:completion:] ()
#18 0x0000000107c336ec in -[UIApplication workspaceDidEndTransaction:] ()
#19 0x000000010c2255e5 in __31-[FBSSerialQueue performAsync:]_block_invoke_2 ()
#20 0x000000010748644c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
#21 0x000000010747c195 in __CFRunLoopDoBlocks ()
#22 0x000000010747bf55 in __CFRunLoopRun ()
#23 0x000000010747b396 in CFRunLoopRunSpecific ()
#24 0x0000000107c33159 in -[UIApplication _run] ()
#25 0x0000000107c35f10 in UIApplicationMain ()
#26 0x00000001062d8a3f in main at /Users/mxn/Documents/Playroom/PeaPod/PeaPod/main.m:14
#27 0x0000000109091145 in start ()

And stderr:

libc++abi.dylib: terminating

@incanus pointed out that calls to Map::start() is getting called twice in a row. It only happens when Map::mode is Mode::Continuous. Currently the only workarounds are to just use the default style or to pass a complete style JSON into -[MGLMapView initWithFrame:styleJSON:accessToken:].

Activity

  1. added
    iOS
    on Mar 17, 2015
  2. added this to the iOS Beta 1 milestone on Mar 17, 2015
  3. changed the title [-]Crash using bundled style after initializing MGLMapView on iOS[/-] [+]Crash using bundled style on iOS[/+] on Mar 17, 2015
  4. changed the title [-]Crash using bundled style on iOS[/-] [+][iOS] Crash using bundled style immediately after instantiation[/+] on Mar 17, 2015
  5. 1ec5 commented on Mar 17, 2015

    @1ec5
    ContributorAuthor

    The crash also reproduces in the iOS sample app if you add a call to -[MGLMapView useBundledStyleNamed:] inside -[MBXViewController viewDidLoad], that is synchronously after instantiating the MGLMapView without an explicit style. The crash looks a little different because the assertion mode == Mode::None fails in debug.

  6. 1ec5 commented on Mar 17, 2015

    @1ec5
    ContributorAuthor

    @kkaefer can you take a look? setStyleURL() only starts the map in continuous mode. MGLMapView may need to call start() if the mode isn’t Continuous, but it has no way of knowing what the mode currently is.

  7. incanus commented on Mar 20, 2015

    @incanus
    Contributor

    Bump @kkaefer.

  8. removed this from the iOS Beta 1 milestone on Mar 20, 2015
  9. 1ec5 commented on Mar 20, 2015

    @1ec5
    ContributorAuthor

    I don’t think this is necessary for beta 1 if we’re going forward with #1031. The crash doesn’t occur if you just let the init method choose the default style for you.

  10. added this to the iOS Beta 2 milestone on Mar 20, 2015
  11. incanus commented on Mar 24, 2015

    @incanus
    Contributor

    Think this is handled in #1077.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

crashiOS

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions