0
\$\begingroup\$

I am using pygame on a mac, and when the app runs, it draws a frame of the screen fine, and then crashes with the following error:

Assertion failed: (NSViewIsCurrentlyBuildingLayerTreeForDisplay() != currentlyBuildingLayerTree), 
function NSViewSetCurrentlyBuildingLayerTreeForDisplay, 
file /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.10.101/AppKit.subproj/NSView.m, 
line 14480.

Everything was working fine, but I did switch to multi-threading, and I think this might be related. Has anyone a clue as to what might be going wrong?

I call:

pygame.init()
pygame_size = 1280, 960  # image dimensions
pygame_screen = pygame.display.set_mode(pygame_size)

in the main thread, and then I have many pygame draw calls.

\$\endgroup\$
  • \$\begingroup\$ Do you touch any pygame functions from a non-main thread? \$\endgroup\$ – Tyyppi_77 Dec 8 '17 at 13:46
  • \$\begingroup\$ Yes. So, Thinking this might be the problem now. I am actually using it as part of running tests and trying to save screen captures of the tests. I am not actually trying to run a multi-threaded game. \$\endgroup\$ – nycynik Dec 8 '17 at 13:49
  • 1
    \$\begingroup\$ YES! I moved the screen creation into the main thread, and now it is not crashing! \$\endgroup\$ – nycynik Dec 8 '17 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.