Skip to content

visibleAnnotations Array Of RMMapView is mutated while beeing enumerated #126

Description

@jklimke

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions