Android: create Pause/ResumeSem semaphore at higher level than CreateWindow()
- If you call onPause() before CreateWindow(), SDLThread will run in infinite loop in background. - If you call onPause() between a DestroyWindow() and a new CreateWindow(), semaphores are invalids. SDLActivity.java: the first resume() starts the SDLThread, don't call nativeResume() as it would post ResumeSem. And the first pause would automatically be resumed.
This commit is contained in:
1 parent
1b24b2eca5
commit
dc263450ff
3 files changed
+39
-20
No files matched your search
@@ -505,10 +505,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
mSDLThread = new Thread(new SDLMain(), "SDLThread");
|
||||
mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
||||
mSDLThread.start();
|
||||
|
||||
// No nativeResume(), don't signal Android_ResumeSem
|
||||
mSurface.handleResume();
|
||||
} else {
|
||||
nativeResume();
|
||||
mSurface.handleResume();
|
||||
}
|
||||
|
||||
nativeResume();
|
||||
mSurface.handleResume();
|
||||
mCurrentNativeState = mNextNativeState;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user