-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Multiple Maps EXEC_BAD_ACCESS TransformState::getLatLng() #1103
Comments
@bleege want to investigate? |
At first glance following variables are declared in global scope in MGLMapView: mbgl::Map *mbglMap = nullptr; When the second MGLMapView is dealloced, they are set to null giving the first MGLMapView zombie pointers. |
This may be related to #1109. |
Got this just now on the latest In [MGLMapView trackGestureEvent:forRecognizer:] at: CGPoint ptInView = CGPointMake([recognizer locationInView:recognizer.view].x, [recognizer locationInView:recognizer.view].y); |
@friedbunny good catch ^^. In the light of day that shouldn't be too surprising as it's doing math with UI objects. I'll move it outside the background thread. |
@friedbunny @bleege The gesture tracking is unrelated to @jonathanduty's original report, which is about 2+ maps in an app and global variable naming collision. Gesture discussion over in #1116. |
@jonathanduty Question here: is this two issues or one? i.e. having two maps in the same app, is the problem with view controllers related or another issue? If related to two maps, I think we can push this off of the b1 milestone, but if it's something else, we might want to address it sooner. |
@incanus both of these are related to having 2 maps in the same app, however both do not need to be visible at the same time for either of these bugs to happen.
|
Any workarounds for this until it can be fixed? This one hurts after adding a second map to my app. |
If you don't need to view two maps simultaneously, just change the style pointing to your new source/style. Basically never delete MGLMapView object and reuse it when switching UIViewControllers. |
That did the trick. Thanks. |
Can someone explain me how to share the map between views? The map returns nil for me by singleton instance. |
To summarize the current status here:
|
Simple use case showing problems with 2+ map views: |
Related: #1102 |
fixes #1103: allow multiple maps by not using global pointers
setup:
I modified the left and right navbar buttons to either push a new MBXViewController or pop it using the UINavigationController. I wanted to test navigating from one map to another using push/pop UINavigation controller.
Steps:
Open app. Let first map fully load. Hit right bar button to navigate to new map. Hit left button to navigate back to first map. Touch the screen, you get a EXEC_BAD_ACCESS
The text was updated successfully, but these errors were encountered: