commit 29fdea141155f72787c63de3c9e8ed82ccb79db3
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri Dec 16 19:54:02 2022 +0100

    New app reproduces an issue with crash on my physical LG phone.

diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index dfb8476..d64a19f 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -62,5 +62,6 @@
         <activity android:name=".singlemesh.SingleMeshActivity"/>
         <activity android:name=".meshfile.MeshFileActivity"/>
         <activity android:name=".flatblur.FlatBlurActivity"/>
+        <activity android:name=".flatblur2.FlatBlur2Activity"/>
     </application>
 </manifest>
diff --git a/src/main/java/org/distorted/examples/TableOfContents.java b/src/main/java/org/distorted/examples/TableOfContents.java
index eca4f50..b8ad229 100644
--- a/src/main/java/org/distorted/examples/TableOfContents.java
+++ b/src/main/java/org/distorted/examples/TableOfContents.java
@@ -37,6 +37,7 @@ import android.widget.SimpleAdapter;
 import org.distorted.examples.deferredjob.DeferredJobActivity;
 import org.distorted.examples.monalisa.MonaLisaActivity;
 import org.distorted.examples.flatblur.FlatBlurActivity;
+import org.distorted.examples.flatblur2.FlatBlur2Activity;
 import org.distorted.examples.sink.SinkActivity;
 import org.distorted.examples.projection.ProjectionActivity;
 import org.distorted.examples.deform.DeformActivity;
@@ -129,6 +130,7 @@ public class TableOfContents extends ListActivity
     SINGLEMESH        (R.drawable.icon_example_singlemesh      , R.string.example_singlemesh           , R.string.example_singlemesh_subtitle           ,            SingleMeshActivity.class),
     MESHFILE          (R.drawable.icon_example_meshfile        , R.string.example_meshfile           , R.string.example_meshfile_subtitle           ,            MeshFileActivity.class),
     FLATBLUR          (R.drawable.icon_example_flatblur        , R.string.example_flatblur         , R.string.example_flatblur_subtitle         , FlatBlurActivity.class ),
+    FLATBLUR2         (R.drawable.icon_example_flatblur        , R.string.example_flatblur         , R.string.example_flatblur_subtitle         , FlatBlur2Activity.class ),
 
     ;
 
diff --git a/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Activity.java b/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Activity.java
new file mode 100644
index 0000000..a95b750
--- /dev/null
+++ b/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Activity.java
@@ -0,0 +1,89 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2016 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Distorted.                                                               //
+//                                                                                               //
+// Distorted is free software: you can redistribute it and/or modify                             //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Distorted is distributed in the hope that it will be useful,                                  //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.examples.flatblur2;
+
+import android.app.Activity;
+import android.opengl.GLSurfaceView;
+import android.os.Bundle;
+import android.view.View;
+
+import org.distorted.examples.R;
+import org.distorted.library.main.DistortedLibrary;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class FlatBlur2Activity extends Activity
+{
+    @Override
+    protected void onCreate(Bundle savedState) 
+      {
+      super.onCreate(savedState);
+      DistortedLibrary.onCreate();
+      setContentView(R.layout.flatblur2layout);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    @Override
+    protected void onPause() 
+      {
+      super.onPause();
+      GLSurfaceView view = findViewById(R.id.flatblur2SurfaceView);
+      view.onPause();
+      DistortedLibrary.onPause();
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    @Override
+    protected void onResume() 
+      {
+      super.onResume();
+      GLSurfaceView view = findViewById(R.id.flatblur2SurfaceView);
+      view.onResume();
+      }
+    
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    @Override
+    protected void onDestroy() 
+      {
+      DistortedLibrary.onDestroy();
+      super.onDestroy();
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void button1(View view)
+      {
+      FlatBlur2SurfaceView v = findViewById(R.id.flatblur2SurfaceView);
+      FlatBlur2Renderer renderer = v.getRenderer();
+      renderer.button1();
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void button2(View view)
+      {
+      FlatBlur2SurfaceView v = findViewById(R.id.flatblur2SurfaceView);
+      FlatBlur2Renderer renderer = v.getRenderer();
+      renderer.button2();
+      }
+}
diff --git a/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Renderer.java b/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Renderer.java
new file mode 100644
index 0000000..96c4828
--- /dev/null
+++ b/src/main/java/org/distorted/examples/flatblur2/FlatBlur2Renderer.java
@@ -0,0 +1,88 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2016 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Distorted.                                                               //
+//                                                                                               //
+// Distorted is free software: you can redistribute it and/or modify                             //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Distorted is distributed in the hope that it will be useful,                                  //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.examples.flatblur2;
+
+import android.opengl.GLSurfaceView;
+
+import org.distorted.library.main.DistortedLibrary;
+import org.distorted.library.main.DistortedScreen;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+class FlatBlur2Renderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
+{
+    private final GLSurfaceView mView;
+    private final DistortedScreen mScreen;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    FlatBlur2Renderer(GLSurfaceView v)
+      {
+      mView = v;
+      mScreen = new DistortedScreen();
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void onDrawFrame(GL10 glUnused) 
+      {
+      mScreen.render(System.currentTimeMillis());
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void onSurfaceChanged(GL10 glUnused, int width, int height)
+      {
+      mScreen.resize(width,height);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
+      {
+      OverlayStars.enableEffects();
+      DistortedLibrary.onSurfaceCreated( mView.getContext(), this);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void distortedException(Exception ex)
+      {
+      android.util.Log.e("FlatBlur2", ex.getMessage() );
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void button1()
+      {
+      OverlayStars stars = new OverlayStars();
+      stars.startOverlay(mScreen);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void button2()
+      {
+
+      }
+}
diff --git a/src/main/java/org/distorted/examples/flatblur2/FlatBlur2SurfaceView.java b/src/main/java/org/distorted/examples/flatblur2/FlatBlur2SurfaceView.java
new file mode 100644
index 0000000..f49c2a5
--- /dev/null
+++ b/src/main/java/org/distorted/examples/flatblur2/FlatBlur2SurfaceView.java
@@ -0,0 +1,57 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2016 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Distorted.                                                               //
+//                                                                                               //
+// Distorted is free software: you can redistribute it and/or modify                             //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Distorted is distributed in the hope that it will be useful,                                  //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.examples.flatblur2;
+
+import android.app.ActivityManager;
+import android.content.Context;
+import android.content.pm.ConfigurationInfo;
+import android.opengl.GLSurfaceView;
+import android.util.AttributeSet;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+class FlatBlur2SurfaceView extends GLSurfaceView
+{
+    private FlatBlur2Renderer mRenderer;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public FlatBlur2SurfaceView(Context context, AttributeSet attrs)
+      {
+      super(context, attrs);
+
+      if(!isInEditMode())
+        {
+        mRenderer = new FlatBlur2Renderer(this);
+        final ActivityManager activityManager     = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
+        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
+        setRenderer(mRenderer);
+        }
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public FlatBlur2Renderer getRenderer()
+      {
+      return mRenderer;
+      }
+}
+
diff --git a/src/main/java/org/distorted/examples/flatblur2/OverlayStars.java b/src/main/java/org/distorted/examples/flatblur2/OverlayStars.java
new file mode 100644
index 0000000..c0146a5
--- /dev/null
+++ b/src/main/java/org/distorted/examples/flatblur2/OverlayStars.java
@@ -0,0 +1,167 @@
+package org.distorted.examples.flatblur2;
+
+import org.distorted.library.effect.EffectQuality;
+import org.distorted.library.effect.PostprocessEffectGlow;
+import org.distorted.library.effect.VertexEffectMove;
+import org.distorted.library.effect.VertexEffectScale;
+import org.distorted.library.main.DistortedEffects;
+import org.distorted.library.main.DistortedNode;
+import org.distorted.library.main.DistortedScreen;
+import org.distorted.library.main.DistortedTexture;
+import org.distorted.library.main.InternalOutputSurface;
+import org.distorted.library.mesh.MeshQuad;
+import org.distorted.library.message.EffectListener;
+import org.distorted.library.type.Dynamic;
+import org.distorted.library.type.Dynamic2D;
+import org.distorted.library.type.Dynamic3D;
+import org.distorted.library.type.Dynamic4D;
+import org.distorted.library.type.Static2D;
+import org.distorted.library.type.Static3D;
+import org.distorted.library.type.Static4D;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class OverlayStars implements EffectListener
+{
+   private static final int DUR_MOV =  4000;
+   private static final int DUR_GLO =  2000;
+
+   private static final int[] colors = new int[] {0,0,1,  1,0,1,  1,0,0,  1,1,0,  0,1,0,  1,1,1}; // blue, pink, red, yellow, green, white
+   private static final int INDEX = 5;
+
+   private DistortedNode mNode1, mNode2;
+   private DistortedScreen mScreen;
+
+   private float mWidth;
+   private long mMoveID, mGlowID;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+   private Dynamic3D createRandomMove()
+      {
+      Dynamic3D move = new Dynamic3D();
+      move.setMode(Dynamic.MODE_PATH);
+      move.setDuration(DUR_MOV);
+      move.setCount(0.5f);
+
+      Static3D pointS = new Static3D(0,-500,0);
+      Static3D pointE = new Static3D(0,0,0);
+
+      move.add(pointS);
+      move.add(pointE);
+
+      return move;
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+   private DistortedNode createNode2()
+      {
+      DistortedTexture texture = new DistortedTexture();
+      texture.setColorARGB(0xffff0000);
+
+      MeshQuad mesh = new MeshQuad();
+
+      DistortedEffects effects = new DistortedEffects();
+
+      float scaleP  = mWidth*0.15f;
+      VertexEffectScale scaleE = new VertexEffectScale(scaleP);
+      scaleE.setMeshAssociation(1,-1);
+      effects.apply(scaleE);
+
+      Dynamic3D moveP = createRandomMove();
+      VertexEffectMove moveE= new VertexEffectMove(moveP);
+      moveE.setMeshAssociation(0,0);
+      effects.apply(moveE);
+
+      mMoveID = moveE.getID();
+      moveE.notifyWhenFinished(this);
+
+      return new DistortedNode(texture,effects,mesh);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+   private DistortedNode createNode1()
+      {
+      DistortedTexture texture = new DistortedTexture();
+      texture.setColorARGB(0xffff0000);
+
+      MeshQuad mesh = new MeshQuad();
+
+      DistortedEffects effects = new DistortedEffects();
+
+      float scaleM  = mWidth*0.40f;
+      Static3D moveM= new Static3D(0,0,1);
+
+      VertexEffectMove mainMove  = new VertexEffectMove(moveM);
+      VertexEffectScale mainScale= new VertexEffectScale(scaleM);
+
+      effects.apply(mainMove);
+      effects.apply(mainScale);
+
+      return new DistortedNode(texture,effects,mesh);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+   public void startOverlay(DistortedScreen screen)
+      {
+      mScreen = screen;
+      mWidth = mScreen.getWidth();
+
+      mNode1 = createNode1();
+      mNode1.enableDepthStencil(InternalOutputSurface.NO_DEPTH_NO_STENCIL);
+      mScreen.attach(mNode1);
+
+      mNode2 = createNode2();
+      mNode2.enableDepthStencil(InternalOutputSurface.NO_DEPTH_NO_STENCIL);
+      mScreen.attach(mNode2);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+   public void effectFinished(long id)
+      {
+      if( id==mMoveID )
+         {
+         Dynamic2D haloRadius = new Dynamic2D(DUR_GLO,1.0f);
+         haloRadius.add(new Static2D( 0, 0));
+         haloRadius.add(new Static2D(15,50));
+         haloRadius.add(new Static2D( 0, 0));
+
+         Dynamic4D color= new Dynamic4D(DUR_GLO,1.0f);
+         Static4D P1    = new Static4D(colors[3*INDEX],colors[3*INDEX+1], colors[3*INDEX+2], 0.0f);
+         Static4D P2    = new Static4D(colors[3*INDEX],colors[3*INDEX+1], colors[3*INDEX+2], 0.5f);
+         color.add(P1);
+         color.add(P2);
+         color.add(P1);
+
+         PostprocessEffectGlow glow = new PostprocessEffectGlow(haloRadius,color);
+         glow.setQuality(EffectQuality.MEDIUM);
+         mGlowID = glow.getID();
+         glow.notifyWhenFinished(this);
+         DistortedEffects effects = mNode1.getEffects();
+         effects.apply(glow);
+         }
+      if( id==mGlowID )
+         {
+         mScreen.detach(mNode1);
+         mNode1.markForDeletion();
+         mNode1=null;
+         mScreen.detach(mNode2);
+         mNode2.markForDeletion();
+         mNode2=null;
+         }
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  @SuppressWarnings("unused")
+  public static void enableEffects()
+     {
+     VertexEffectMove.enable();
+     VertexEffectScale.enable();
+     PostprocessEffectGlow.enable();
+     }
+}
\ No newline at end of file
diff --git a/src/main/res/layout/flatblur2layout.xml b/src/main/res/layout/flatblur2layout.xml
new file mode 100644
index 0000000..68c01e3
--- /dev/null
+++ b/src/main/res/layout/flatblur2layout.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical" >
+
+    <org.distorted.examples.flatblur2.FlatBlur2SurfaceView
+        android:id="@+id/flatblur2SurfaceView"
+        android:layout_width="fill_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1" />
+
+    <LinearLayout
+        android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center">
+
+        <Button
+                android:id="@+id/flatblur2Button1"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:onClick="button1"
+                android:checked="false"/>
+        <Button
+                android:id="@+id/flatblur2Button2"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:onClick="button2"
+                android:checked="false"/>
+
+    </LinearLayout>
+
+</LinearLayout>
