mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 21:17:45 +00:00
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:
@@ -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