mirror of https://github.com/encounter/SDL.git
[Android] Fixes #2679 - Crash resuming from screen off
Before destroying the static Java-side data, wait for the SDL native thread, *and* the listener thread that waits on it to trigger a clean up.
This commit is contained in:
parent
60df813042
commit
e7f2f85c3d
|
@ -932,16 +932,16 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
||||||
// This is the entry point to the C app.
|
// This is the entry point to the C app.
|
||||||
// Start up the C app thread and enable sensor input for the first time
|
// Start up the C app thread and enable sensor input for the first time
|
||||||
|
|
||||||
SDLActivity.mSDLThread = new Thread(new SDLMain(), "SDLThread");
|
final Thread sdlThread = new Thread(new SDLMain(), "SDLThread");
|
||||||
enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
||||||
SDLActivity.mSDLThread.start();
|
sdlThread.start();
|
||||||
|
|
||||||
// Set up a listener thread to catch when the native thread ends
|
// Set up a listener thread to catch when the native thread ends
|
||||||
new Thread(new Runnable(){
|
SDLActivity.mSDLThread = new Thread(new Runnable(){
|
||||||
@Override
|
@Override
|
||||||
public void run(){
|
public void run(){
|
||||||
try {
|
try {
|
||||||
SDLActivity.mSDLThread.join();
|
sdlThread.join();
|
||||||
}
|
}
|
||||||
catch(Exception e){}
|
catch(Exception e){}
|
||||||
finally{
|
finally{
|
||||||
|
@ -951,7 +951,8 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
});
|
||||||
|
SDLActivity.mSDLThread.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue