scummvm/scummvm — pull request #432 by klusark (2014-01-28 04:05:35+00:00)
Title: ANDROID: Fix a race condition

setSurface is done in a different thread than the one that starts the scummvm main. The main thread would then wait until the setSurface thread notifies. The setSurface thread would notify before it actually calls setSurface, meaning if the thread is preemted before calling setSurface, initSurface will assert, causing the app to crash.

I've never actually seen this crash in ScummVM, but this fixes the issue for ResidualVM. I assume it happens in ResidualVM because we are using a native size surface which takes longer to create.