You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
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
@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:].
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.
@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.
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.
Activity
[-]Crash using bundled style after initializing MGLMapView on iOS[/-][+]Crash using bundled style on iOS[/+][-]Crash using bundled style on iOS[/-][+][iOS] Crash using bundled style immediately after instantiation[/+]1ec5 commentedon Mar 17, 2015
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 theMGLMapViewwithout an explicit style. The crash looks a little different because the assertionmode == Mode::Nonefails in debug.1ec5 commentedon Mar 17, 2015
@kkaefer can you take a look?
setStyleURL()only starts the map in continuous mode.MGLMapViewmay need to callstart()if themodeisn’tContinuous, but it has no way of knowing what themodecurrently is.Added API for initializing with bundled style
Added API for initializing with bundled style
incanus commentedon Mar 20, 2015
Bump @kkaefer.
1ec5 commentedon Mar 20, 2015
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.
incanus commentedon Mar 24, 2015
Think this is handled in #1077.