Project

General

Profile

« Previous | Next » 

Revision 8d98b65f

Added by Leszek Koltunski over 2 years ago

Move destroying most of statics from onDestroy() earlier, to onPause().

Reason: doing this in onDestroy() is too late, because when we have two activities, and switch between them, first the ending's Activity onPause() is called, then the starting Activity's onResume, then it's onSurfaceCreated(), then we insert all the effects, and only then the ending Activity onDestroy() gets fired off - and this might destroy the already enabled effects, like for example the Programs of the Postprocessing effects.

View differences:

src/main/java/org/distorted/library/effect/Effect.java
93 93
 *
94 94
 * @y.exclude
95 95
 */
96
  public static void onDestroy()
96
  public static void onPause()
97 97
    {
98 98
    for(int i=0; i<NUM_EFFECTS; i++) mEnabled[i] = false;
99 99

  
src/main/java/org/distorted/library/main/DistortedLibrary.java
1121 1121
  public static void onPause(long id)
1122 1122
    {
1123 1123
    InternalStackFrameList.onPause(id);
1124

  
1124 1125
    Dynamic.onPause();  // common for all frames
1126
    InternalOutputSurface.onPause();
1127
    Effect.onPause();
1128
    DeferredJobs.onPause();
1129

  
1130
    mOITCompilationAttempted = false;
1131
    mNeedsTransformFeedback  = false;
1125 1132

  
1126 1133
    mLinkedListSSBO[0]= -1;
1127 1134
    mAtomicCounter = null;
......
1161 1168
    if( InternalStackFrameList.isInitialized() )
1162 1169
      {
1163 1170
      InternalStackFrameList.onDestroy(id);
1164

  
1165
      InternalOutputSurface.onDestroy(); // those three really destroy
1166
      Effect.onDestroy();                // static data that does not
1167
      DeferredJobs.onDestroy();          // need to be part of a frame
1168

  
1169
      mOITCompilationAttempted = false;
1170
      mNeedsTransformFeedback  = false;
1171 1171
      }
1172 1172
    }
1173 1173

  
src/main/java/org/distorted/library/main/InternalOutputSurface.java
207 207

  
208 208
///////////////////////////////////////////////////////////////////////////////////////////////////
209 209

  
210
  static synchronized void onDestroy()
210
  static synchronized void onPause()
211 211
    {
212 212
    for (int j=0; j<EffectQuality.LENGTH; j++)
213 213
      if( mBuffer[j]!=null )
src/main/java/org/distorted/library/mesh/DeferredJobs.java
401 401
 *
402 402
 * @y.exclude
403 403
 */
404
  public static void onDestroy()
404
  public static void onPause()
405 405
    {
406 406
    int num = mJobs.size();
407 407

  

Also available in: Unified diff