Technical Q&A QA1766

How to fix OpenGL ES application crashes when moving to the background

Q:  My OpenGL ES application crashes when moving to the background. How do I fix it?

A: If your OpenGL ES application crashes when moving to the background, and you get a crash report that contains a stack trace ending with libGPUSupportMercury.dylib: gpus_ReturnNotPermittedKillClient + 0 as shown in Listing 1, it indicates that the application has attempted to do rendering with OpenGL ES in the background.

Listing 1  Stack trace

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libGPUSupportMercury.dylib    	0x30570094 gpus_ReturnNotPermittedKillClient + 0
1   libGPUSupportMercury.dylib    	0x305700ae gpus_KillClient ( )
2   libGPUSupportMercury.dylib    	0x305705ba gpusSubmitDMABuffers ( )
3   IMGSGX535GLDriver             	0x34bd29b8 SubmitPacketsIfAny ( )
4   IMGSGX535GLDriver             	0x34bd2ad0 glrFlushContextToken ( )
5   GLEngine                      	0x37719c4a gliPresentViewES ( )
6   OpenGLES                      	0x323df6b4 -[EAGLContext presentRenderbuffer:] ( )
...
...

An OpenGL ES application will be terminated if it attempts to execute OpenGL ES commands in the background. Your application must ensure that all previously submitted commands have been finished and then stop rendering prior to moving into the background. See details about how to achieve this in the Implementing a Multitasking-aware OpenGL ES Application chapter of the OpenGL ES Programming Guide for iOS.

See Debugging Deployed iOS Apps for information about how to get a crash report.



Document Revision History


DateNotes
2012-04-09

New document that describes how to fix OpenGL ES application crashes when moving to the background.