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

crash Map(12): EXC_BAD_ACCESS #1913

Closed
DangeloID opened this issue Jul 22, 2015 · 1 comment
Closed

crash Map(12): EXC_BAD_ACCESS #1913

DangeloID opened this issue Jul 22, 2015 · 1 comment

Comments

@DangeloID
Copy link

Hi guys.

When i try add new annotation, i get crash Map(12): EXC_BAD_ACCESS (code=1, address=0x98)

Map (12)#0  0x0000000100175058 in mbgl::MapContext::updateAnnotationTiles(std::__1::unordered_set<mbgl::TileID, mbgl::TileID::Hash, std::__1::equal_to<mbgl::TileID>, std::__1::allocator<mbgl::TileID> > const&) ()
#1  0x000000010016f564 in mbgl::util::RunLoop::Invoker<auto mbgl::util::Thread<mbgl::MapContext>::bind<void (mbgl::MapContext::*)(std::__1::unordered_set<mbgl::TileID, mbgl::TileID::Hash, std::__1::equal_to<mbgl::TileID>, std::__1::allocator<mbgl::TileID> > const&)>(void (mbgl::MapContext::*)(std::__1::unordered_set<mbgl::TileID, mbgl::TileID::Hash, std::__1::equal_to<mbgl::TileID>, std::__1::allocator<mbgl::TileID> > const&))::'lambda'(void (mbgl::MapContext::*&&)(std::__1::unordered_set<mbgl::TileID, mbgl::TileID::Hash, std::__1::equal_to<mbgl::TileID>, std::__1::allocator<mbgl::TileID> > const&)), std::__1::tuple<std::__1::unordered_set<mbgl::TileID, mbgl::TileID::Hash, std::__1::equal_to<mbgl::TileID>, std::__1::allocator<mbgl::TileID> > > >::operator()() ()
#2  0x00000001001f9028 in mbgl::util::RunLoop::process() ()
#3  0x00000001002372bc in uv__async_event at /Users/travis/build/mapbox/mapbox-gl-native/mason_packages/.build/libuv-0.10.28/src/unix/async.c:80
#4  0x0000000100237674 in uv__async_io at /Users/travis/build/mapbox/mapbox-gl-native/mason_packages/.build/libuv-0.10.28/src/unix/async.c:156
#5  0x0000000100250c80 in uv__io_poll at /Users/travis/build/mapbox/mapbox-gl-native/mason_packages/.build/libuv-0.10.28/src/unix/kqueue.c:233
#6  0x0000000100237d20 in uv_run at /Users/travis/build/mapbox/mapbox-gl-native/mason_packages/.build/libuv-0.10.28/src/unix/core.c:317
#7  0x00000001001740cc in void mbgl::util::Thread<mbgl::MapContext>::run<std::__1::tuple<mbgl::View&, mbgl::FileSource&, mbgl::MapData&>, 0ul, 1ul, 2ul>(mbgl::util::ThreadContext, std::__1::tuple<mbgl::View&, mbgl::FileSource&, mbgl::MapData&>&&, std::__1::integer_sequence<unsigned long, 0ul, 1ul, 2ul>) ()
#8  0x0000000100173fc8 in std::__1::__thread_proxy<std::__1::tuple<mbgl::util::Thread<mbgl::MapContext>::Thread<mbgl::View&, mbgl::FileSource&, mbgl::MapData&>(mbgl::util::ThreadContext const&, mbgl::View&&&, mbgl::FileSource&&&, mbgl::MapData&&&)::'lambda'()> >(void*, void*) ()
#9  0x000000019794bdc8 in _pthread_body ()
#10 0x000000019794bd24 in _pthread_start ()

Main tread:Thread 1Queue : com.apple.main-thread (serial)
#0  0x00000001978af0c0 in __psynch_mutexwait ()
#1  0x0000000197949494 in _pthread_mutex_lock ()
#2  0x00000001968b1a40 in std::__1::mutex::lock() ()
#3  0x000000010016c068 in mbgl::Map::addShapeAnnotations(std::__1::vector<mbgl::ShapeAnnotation, std::__1::allocator<mbgl::ShapeAnnotation> > const&) ()
#4  0x000000010021c9c8 in -[MGLMapView addAnnotations:] ()
#5  0x000000010021b2bc in -[MGLMapView addAnnotation:] ()
#6  0x00000001000f9d84 in -[ViewController addHexagonInPoint:] at /Projects/MapBoxGL/MapBoxGL/ViewController.m:89
#7  0x00000001000f99c4 in -[ViewController viewDidLoad] at /Projects/MapBoxGL/MapBoxGL/ViewController.m:55
#8  0x0000000189ef0c18 in -[UIViewController loadViewIfRequired] ()
#9  0x0000000189ef0928 in -[UIViewController view] ()
#10 0x0000000189ef7164 in -[UIWindow addRootViewControllerViewIfPossible] ()
#11 0x0000000189ef4814 in -[UIWindow _setHidden:forced:] ()
#12 0x0000000189f66880 in -[UIWindow makeKeyAndVisible] ()
#13 0x000000018a17aa28 in -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] ()
#14 0x000000018a17d19c in -[UIApplication _runWithMainScene:transitionContext:completion:] ()
#15 0x000000018a17b70c in -[UIApplication workspaceDidEndTransaction:] ()
#16 0x000000018dcb53c8 in __31-[FBSSerialQueue performAsync:]_block_invoke_2 ()
#17 0x000000018543027c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
#18 0x000000018542f384 in __CFRunLoopDoBlocks ()
#19 0x000000018542d9a8 in __CFRunLoopRun ()
#20 0x00000001853592d4 in CFRunLoopRunSpecific ()
#21 0x0000000189f5c3d0 in -[UIApplication _run] ()
#22 0x0000000189f56f40 in UIApplicationMain ()
#23 0x00000001000fa458 in main at /Projects/MapBoxGL/MapBoxGL/main.m:14
#24 0x0000000197796a08 in start ()

Code:

 CLLocationCoordinate2D *coordinateArray = malloc(sizeof(CLLocationCoordinate2D) * locations.count);
int caIndex = 0;
    for (CLLocation *loc in locations) {
        coordinateArray[caIndex] = loc.coordinate;
        caIndex++;
    }    
    MGLPolygon *shape = [MGLPolygon polygonWithCoordinates:coordinateArray
                                                     count:locations.count];
    free(coordinateArray);    
    [self.mapView addAnnotation:shape]; //if commented this line - all good

Xcode 6.4, all ios versions. Mapbox gl 0.5.1

@friedbunny
Copy link
Contributor

Thanks for the report, @DangeloID — this was fixed in #1874. Until the next release, the workaround is to add annotations in viewDidAppear.

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

No branches or pull requests

2 participants