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.

macOS SDK crashes when moving between screens #6654

Closed

Description

@kkaefer

When moving the macOS SDK window between screens (one with a Retina pixel ratio, and the other with a regular pixel ratio in my case), I'm getting a crash when trying to update the FrameHistory texture. It doesn't appear to be specific to that texture since it crashes at other locations as well if that upload is commented out. It seems like doing any sort of OpenGL API call triggers this crash.

Using apitrace, I found that just prior to the crash, CGLUpdateContext is called, and returns kCGLBadDrawable.

The crash does not appear when moving GLFW windows between screens, making me believe that there's something fishy in our use of NSOpenGLLayer or the macOS implementation in general.

/cc @1ec5 @incanus

Activity

  1. added
    macOS
    on Oct 11, 2016
  2. jfirebaugh commented on Oct 11, 2016

    @jfirebaugh
    Contributor

    Probably should consolidate with #5010 and #3451.

  3. incanus commented on Oct 12, 2016

    @incanus
    Contributor

    Out of curiosity, @kkaefer do you see this as merely an annoyance / nice to have or something we should prioritize more highly to be 100% correct? Like, it's not a very common user scenario, right?

  4. kkaefer commented on Oct 13, 2016

    @kkaefer
    MemberAuthor

    It's not super common, but it is an unavoidable crash bug that might deter people from using it on an actual macOS app. That being said, it's also annoying when testing since I sometimes move windows between screens.

  5. 1ec5 commented on Oct 13, 2016

    @1ec5
    Contributor

    It's pretty common to have screens with different pixel densities, particularly on a MacBook that may be hooked up to a non-Apple monitor or a projection screen.

    The higher priority would be to not crash in this scenario. Ideally, the map would refresh with the correct pixel density – there's a notification for that – but auto-refreshing might buck developer expectations around the runtime styling API.

  6. 1ec5 commented on Oct 13, 2016

    @1ec5
    Contributor

    As far as I know, GLFW uses NSOpenGLView but doesn't use NSOpenGLLayer directly as this SDK does.

  7. 1ec5 commented on Jan 25, 2017

    @1ec5
    Contributor

    Per #7819 (comment), moving a map view between different screens doesn’t crash in a Release build, but it does stop rendering, which suggests that it would crash in a Debug build.

    #1799 removed the ability for an mbgl::Map object to transition between different pixel densities. So a proper fix for this issue would entail either undoing #1799 or somehow creating a new mbgl::Map whenever the window moves between screens. Either approach sounds daunting.

  8. added
    Tangram parity
    on Jan 25, 2017
  9. kkaefer commented on Feb 6, 2017

    @kkaefer
    MemberAuthor

    I debugged this further with apitrace and found that when moving the window to a new screen, the underlying NSOpenGLLayer implementation actually destroys the OpenGL context and creates a new one. Of course, that means that all of the OpenGL handles we've stored in our internal state are now invalid, leading to the crash.

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

    Tangram paritycrashmacOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions