Try a silly workaround for an otherwise unexplainable crash seen in Google Play Console

This commit is contained in:
Henrik Rydgård 2017-12-01 19:55:55 +01:00
parent 8a0645859e
commit 5fbbb3e115
4 changed files with 19 additions and 2 deletions

View File

@ -651,6 +651,17 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C
protected void onDestroy() {
super.onDestroy();
if (javaGL) {
if (nativeRenderer.isRenderingFrame()) {
Log.i(TAG, "Waiting for renderer to finish.");
int tries = 200;
do {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
}
tries--;
} while (nativeRenderer.isRenderingFrame() && tries > 0);
}
Log.i(TAG, "onDestroy");
mGLSurfaceView.onDestroy();
// Probably vain attempt to help the garbage collector...

View File

@ -32,7 +32,6 @@ public class NativeApp {
public static native void pause();
public static native void resume();
// There's not really any reason to ever call shutdown as we can recover from a killed activity.
public static native void shutdown();
public static native boolean keyDown(int deviceId, int key, boolean isRepeat);

View File

@ -13,13 +13,20 @@ import android.view.Display;
public class NativeRenderer implements GLSurfaceView.Renderer {
private static String TAG = "NativeRenderer";
private NativeActivity mActivity;
private boolean inFrame;
NativeRenderer(NativeActivity act) {
mActivity = act;
}
public boolean isRenderingFrame() {
return inFrame;
}
public void onDrawFrame(GL10 unused /*use GLES20*/) {
inFrame = true;
displayRender();
inFrame = false;
}
public void onSurfaceCreated(GL10 unused, EGLConfig config) {

View File

@ -2,7 +2,7 @@
#include "VulkanQueueRunner.h"
#include "VulkanRenderManager.h"
// Debug help: adb logcat -s DEBUG PPSSPPNativeActivity PPSSPP
// Debug help: adb logcat -s DEBUG PPSSPPNativeActivity PPSSPP NativeGLView NativeRenderer NativeSurfaceView PowerSaveModeReceiver InputDeviceState
void VulkanQueueRunner::CreateDeviceObjects() {
ILOG("VulkanQueueRunner::CreateDeviceObjects");