Fixed: occasional crash at android.view.Surface.checkNotReleasedLocked(Surface.java:753) when app is backgrounded

[CL 22406650 by dmitriy dyomin in ue5-main branch]
This commit is contained in:
dmitriy dyomin
2022-10-07 15:09:39 -04:00
parent 796e686854
commit 30bfa72155
2 changed files with 12 additions and 3 deletions

View File

@@ -5399,11 +5399,19 @@ public class GameActivity extends $${gameActivitySuperClass}$$ implements Surfac
@Override
public void run()
{
MySurfaceView.getHolder().getSurface().setFrameRate(FinalRefreshRate, android.view.Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE);
// the window might be gone by the time this code runs
try
{
MySurfaceView.getHolder().getSurface().setFrameRate(FinalRefreshRate, android.view.Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE);
}
catch (Exception e)
{
Log.debug("setFrameRate failed. "+ e.getMessage());
}
}
});
Log.debug("SetNativeDisplayRefreshRate - setFrameRate " + RefreshRate);
return true;
}
else if(ANDROID_BUILD_VERSION >= 24)