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.

MGLMapView fails to bind EAGLDrawable when initialised with CGRect with no width and height #1572

Closed

Description

@duemunk

Initialising a MGLMapView with CGRectZero:

let map = MGLMapView(frame: CGRectZero, accessToken: "_")

Crashes:

2015-05-16 16:56:35.782 SomeApp[35232:1946290] Failed to bind EAGLDrawable: <CAEAGLLayer: 0x17403a940> to GL_RENDERBUFFER 1
2015-05-16 16:56:35.783 SomeApp[35232:1946290] Failed to make complete framebuffer object 8cd6
2015-05-16 16:56:35.800 SomeApp[35232:1946361] [ERROR] {0}{Map}[Shader]: Program failed to validate: Validation Failed: Current draw framebuffer is invalid.

Current workaround

let map = MGLMapView(frame: CGRect(x: 0, y: 0, width: 1, height: 1), accessToken: "_")

Activity

  1. added
    iOS
    on May 16, 2015
  2. 1ec5 commented on May 27, 2015

    @1ec5
    Contributor

    Via #1654, MGLMapView should also support CGRectNull.

  3. 1ec5 commented on Jan 26, 2016

    @1ec5
    Contributor

    -[MGLMapView wakeGL:] should guard on CGRectIsEmpty(), and probably CGRectIsInfinite() while we’re at it. -setFrame: and -setBounds: should trigger this check and cause binding to occur if the frame changes from being empty (or infinite) to a reasonable value.

  4. 1ec5 commented on Feb 22, 2016

    @1ec5
    Contributor

    Per #4065, initializing the map view with an empty frame no longer crashes. It looks like the validation step that was failing was removed in #2147.

  5. added and removed on Feb 22, 2016
  6. changed the title [-]MGLMapView crash error when initialised with CGRect with no width and height[/-] [+]MGLMapView fails to bind EAGLDrawable when initialised with CGRect with no width and height[/+] on Feb 22, 2016
  7. added this to the ios-v3.2.0 milestone on Feb 25, 2016
  8. 1ec5 commented on Jun 28, 2016

    @1ec5
    Contributor

    Per the comments in #5457, the crash has returned. However, I’m unable to reproduce it on either a simulator or a device.

  9. modified the milestones: ios-v3.4.0, ios-v3.3.0 on Jun 29, 2016
  10. 11 remaining items

  11. removed this from the ios-future milestone on Nov 4, 2016
  12. modified the milestones: ios-future, ios-v3.4.0 on Nov 30, 2016
  13. brunoabinader commented on Apr 4, 2017

    @brunoabinader
    Contributor

    As per #8562, using a zeroed CGRect will cause the core to throw a runtime exception.

  14. 1ec5 commented on Apr 4, 2017

    @1ec5
    Contributor

    Reopening: it’s very common for a UIView or NSView to be initialized with zero size and given a size at some point before or after being added to the view hierarchy. This crash is a gotcha for many developers.

  15. reopened this on Apr 4, 2017
  16. added
    Google Maps parity
    macOS
    MapKit parity
    and removed on Apr 4, 2017
  17. 1ec5 commented on Apr 4, 2017

    @1ec5
    Contributor

    @brunoabinader proposes that MGLMapView always create mbgl::Map with a minimum size of 64×64 points, even if MGLMapView and EAGLView themselves are smaller than 64×64 points. This might work, although it might also throw off any calculations that are dependent on the screen location of the center coordinate at initialization.

  18. 1ec5 commented on Apr 10, 2017

    @1ec5
    Contributor

    #8562 ended up implementing the 64x64-point workaround described above, which should address this crash and console spew.

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

    Google Maps parityMapKit paritycrashiOSmacOS

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions