Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Make sure display is released between activities and kill process bet…
Browse files Browse the repository at this point in the history
…ween runs to prevent WebVR crash
  • Loading branch information
Randall Barker committed Sep 15, 2018
1 parent 5d0e8eb commit 26cf841
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ protected void onDestroy() {

SessionStore.get().clearListeners();
super.onDestroy();
// FIXME: HACK TO KILL GECKO BETWEEN RUNS.
android.os.Process.killProcess(android.os.Process.myPid());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ public void setSurfaceTexture(SurfaceTexture aTexture, final int aWidth, final i
mSurface = new Surface(aTexture);
if (mDisplay == null) {
mDisplay = session.acquireDisplay();
} else {
Log.e(LOGTAG, "GeckoDisplay was not null in BrowserWidget.setSurfaceTexture()");
}
mDisplay.surfaceChanged(mSurface, aWidth, aHeight);
}
Expand Down Expand Up @@ -180,6 +182,11 @@ public void releaseWidget() {
if (session == null) {
return;
}
if (mDisplay != null) {
mDisplay.surfaceDestroyed();
session.releaseDisplay(mDisplay);
mDisplay = null;
}
session.getTextInput().setView(null);
}

Expand Down Expand Up @@ -219,6 +226,7 @@ public void onCurrentSessionChange(GeckoSession aSession, int aId) {
oldSession.getTextInput().setView(null);
mDisplay.surfaceDestroyed();
oldSession.releaseDisplay(mDisplay);
mDisplay = null;
}

mSessionId = aId;
Expand Down

0 comments on commit 26cf841

Please sign in to comment.