threerings/flump — pull request #112 by karlatplumbee (2014-02-07 14:21:18+00:00)
Title: Loader patch to prevent immediate upload to GPU on load complete

Hi

This is a pretty rough and ready patch which we used to prevent texture errors as a result of trying to upload to GPU when application is deactivated (i.e. in background) in iOS7. An example of the stack trace is given below which was obtained from our logs.

195) - 1391676461514 [4] NativeApplicationController Application Deactivated
196) - 1391676461556 [4] SessionController Closing session: 714
197) - 1391676470061 [8] Error: Error #3768
at starling.textures::ConcreteTexture/uploadBitmapData()
at starling.textures::Texture$/fromBitmapData()
at Function/OP_newfunction'd in flump.display:Loader::loadAtlas.()
at RListener1/onEmit()
at react::AbstractSignal/notifyEmit()
at react::Signal/emit()
at flump.executor::Future/onSuccess()
at flump.executor.load::ImageLoader/handleSuccess()
at Function/OP_newfunction'd in public::.()

You can see that the application is deactivated and then attempts to upload bitmap data. The patch presented uploads textures only when in the foreground and provides the texture through a callback. You may wish to adapt this to use futures or another asynchronous mechanism.