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

visibleAnnotations Array Of RMMapView is mutated while beeing enumerated #126

Open
jklimke opened this issue Feb 16, 2013 · 1 comment
Open
Labels

Comments

@jklimke
Copy link

jklimke commented Feb 16, 2013

I found a synchronization problem within the addAnnotations method of RMMapView. I am currently doing under some circumstances a parallel load of data for Annotations from the web. When i add them (not necessarily in the same thread), via the method addAnnotations, it happens that there is a parallel modification of RMMapViews _visibleAnnotations property within the method correctPositionOfAllAnnotationsIncludingInvisibles

As a fix i would propose to include the method call into the synchronization, or aquiring a second lock on visibleAnnotations during the method correctPositionOfAllAnnotationsIncludingInvisibles. Currently only the _annotations array is synchronized.

 @synchronized (_annotations)
    {
        [_annotations addObjectsFromArray:newAnnotations];
        [self.quadTree addAnnotations:newAnnotations];
    }

    [self correctPositionOfAllAnnotationsIncludingInvisibles:YES animated:NO];

The same should apply to the removeAnnotations method.

@trasch
Copy link

trasch commented Feb 19, 2013

Thanks for the catch, I will have a look at it!

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

No branches or pull requests

2 participants