From c9f4debdb17e1f3b9fca74a03f6593c12aa9327d Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Mon, 22 Aug 2016 21:53:49 -0700 Subject: Request render before waiting There was a race condition between the GL thread and the main thread. If GL thread was much quicker because of scheduling delays, GL thread already drew the first frame before main thread was reaching resume(). In that case, synch.wait() will just hang because nobody else requested a frame because the rendering was set to on-demand. Now, we explicitely request a frame after setting resume=true so we can make sure a frame gets scheduled with resume=true so we get notified on the synch. Change-Id: Id98c9489011d39c6472a98f3e4cb1bfc7b0596ff Fixes: 30967728 --- .../com/badlogic/gdx/backends/android/AndroidGraphicsLiveWallpaper.java | 1 + 1 file changed, 1 insertion(+) diff --git a/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGraphicsLiveWallpaper.java b/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGraphicsLiveWallpaper.java index 5fcd0e421..0cb036837 100644 --- a/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGraphicsLiveWallpaper.java +++ b/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGraphicsLiveWallpaper.java @@ -136,6 +136,7 @@ public final class AndroidGraphicsLiveWallpaper extends AndroidGraphics { // by jw: added synchronization, there was nothing before while (resume) { try { + requestRendering(); synch.wait(); } catch (InterruptedException ignored) { Gdx.app.log("AndroidGraphics", "waiting for resume synchronization failed!"); -- cgit v1.2.3