OSDN Git Service

Make surfaceRedrawNeeded forgiving
authorJohn Reck <jreck@google.com>
Mon, 18 Apr 2016 20:26:48 +0000 (13:26 -0700)
committerJohn Reck <jreck@google.com>
Mon, 18 Apr 2016 20:26:48 +0000 (13:26 -0700)
Fixes: 27071678

It's semi-common for apps to not realize surfaceRedrawNeeded
is a callback they can (and should) be handling, so have it be
more tolerant in lifecycle handling.

Specifically allow a renderer to have not yet been set on
GLSurfaceView, even though it was supposed to have been set already.
Apps are overriding the other lifecycle methods that require this
(created, changed, an destroyed) but not noticing this method.

Change-Id: I6cebca541eeec6e9949bdb55f687b095768a17b2

opengl/java/android/opengl/GLSurfaceView.java

index f37ec58..38ed932 100644 (file)
@@ -547,7 +547,9 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
      */
     @Override
     public void surfaceRedrawNeeded(SurfaceHolder holder) {
-        mGLThread.requestRenderAndWait();
+        if (mGLThread != null) {
+            mGLThread.requestRenderAndWait();
+        }
     }