diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index 1eea8c70f9..5601a8462d 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -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... diff --git a/android/src/org/ppsspp/ppsspp/NativeApp.java b/android/src/org/ppsspp/ppsspp/NativeApp.java index 4ec90e6fc9..dd78133e0c 100644 --- a/android/src/org/ppsspp/ppsspp/NativeApp.java +++ b/android/src/org/ppsspp/ppsspp/NativeApp.java @@ -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); diff --git a/android/src/org/ppsspp/ppsspp/NativeRenderer.java b/android/src/org/ppsspp/ppsspp/NativeRenderer.java index 87191e8089..288beba61a 100644 --- a/android/src/org/ppsspp/ppsspp/NativeRenderer.java +++ b/android/src/org/ppsspp/ppsspp/NativeRenderer.java @@ -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) { diff --git a/ext/native/thin3d/VulkanQueueRunner.cpp b/ext/native/thin3d/VulkanQueueRunner.cpp index e49ff6bd4c..59937c9d39 100644 --- a/ext/native/thin3d/VulkanQueueRunner.cpp +++ b/ext/native/thin3d/VulkanQueueRunner.cpp @@ -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");