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

[ios,macos] Spurious assertion in annotationTagAtPoint #12103

Closed

Description

@ChrisLoer

In MGLMapView we trigger an assertion if queryRenderedSymbols returns an annotation tag that's not in our current set of annotation tags:

std::vector<MGLAnnotationTag> nearbyAnnotations = [self annotationTagsInRect:queryRect];
std::vector<MGLAnnotationTag> nearbyShapeAnnotations = [self shapeAnnotationTagsInRect:queryRect];
if (nearbyShapeAnnotations.size()) {
nearbyAnnotations.insert(nearbyAnnotations.end(), nearbyShapeAnnotations.begin(), nearbyShapeAnnotations.end());
}
if (nearbyAnnotations.size())
{
// Assume that the user is fat-fingering an annotation.
CGRect hitRect = CGRectInset({ point, CGSizeZero },
-MGLAnnotationImagePaddingForHitTest,
-MGLAnnotationImagePaddingForHitTest);
// Filter out any annotation whose image or view is unselectable or for which
// hit testing fails.
auto end = std::remove_if(nearbyAnnotations.begin(), nearbyAnnotations.end(), [&](const MGLAnnotationTag annotationTag) {
id <MGLAnnotation> annotation = [self annotationWithTag:annotationTag];
NSAssert(annotation, @"Unknown annotation found nearby tap");
if ( ! annotation)
{
return true;
}

But the assumption that the current set of annotation tags should be perfectly in sync with annotationTagsInRect is incorrect. The underlying queryRenderedSymbols is working off the latest collision index, which may be up to 300ms old. If a tag has just been removed, it still may show up in queryRenderdSymbols results.

It might make sense to filter out non-current tags in annotationTagsInRect, but I think the current behavior of just doing the filtering right below the assertion with a return true looks right. We should poke around a little, but basically I think the assertion just needs to be removed.

/cc @julianrex @ansis @fabian-guerra

Activity

  1. 1ec5 commented on Jun 14, 2018

    @1ec5
    Contributor

    Related: #8655.

  2. added
    iOS
    macOS
    on Jul 31, 2018
  3. added
    archived
    on Jan 27, 2019
  4. stale commented on Jan 28, 2019

    @stale

    This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

  5. removed
    archived
    on Jan 28, 2019
  6. added
    archived
    on Jul 27, 2019
  7. stale commented on Jul 27, 2019

    @stale

    This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

  8. removed
    archived
    on Jul 29, 2019
  9. removed their assignment
    on Aug 16, 2021
  10. julianrex commented on Aug 16, 2021

    @julianrex
    Contributor

    Closing as stale.

  11. julianrex commented on Aug 16, 2021

    @julianrex
    Contributor

    Closing as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    iOSmacOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions