Don't destory the engine when detaching from the window

Reading the Android docs, it sounds like an android.view.View can re-attach to
the window after detaching. Previously, we destroyed the engine when we
detached from the window. Now we wait for the activity to be destroyed.

Hopefully fixes #997
This commit is contained in:
Adam Barth 2016-01-04 10:39:09 -08:00
parent 6ed78c58e0
commit 241fc21055
2 changed files with 4 additions and 2 deletions

View File

@ -131,8 +131,7 @@ public class PlatformViewAndroid extends SurfaceView {
return mSkyEngine;
}
@Override
protected void onDetachedFromWindow() {
void destroy() {
getHolder().removeCallback(mSurfaceCallback);
nativeDetach(mNativePlatformView);
mNativePlatformView = 0;

View File

@ -86,6 +86,9 @@ public class SkyActivity extends Activity {
*/
@Override
protected void onDestroy() {
if (mView != null) {
mView.destroy();
}
// Do we need to shut down Sky too?
mTracingController.stop();
super.onDestroy();