[Scummvm-cvs-logs] scummvm master -> 0a00f2c91ab43e7d195856c8463e6b5e4d75486a

fuzzie fuzzie at fuzzie.org
Sat Feb 15 17:55:00 CET 2014


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2d903d9668 ANDROID: Fix a race condition
0a00f2c91a Merge pull request #432 from klusark/race


Commit: 2d903d966875bb2bc665cd33d3514fb6b2dcf7f5
    https://github.com/scummvm/scummvm/commit/2d903d966875bb2bc665cd33d3514fb6b2dcf7f5
Author: Joel Teichroeb (joel at teichroeb.net)
Date: 2014-01-27T18:29:00-08:00

Commit Message:
ANDROID: Fix a race condition

setSurface is done in a different thread than the one that starts
the scummvm main. The main thread would then wait until the setSurface
thread notifies. The setSurface thread would notify before it actually
calls setSurface, meaning if the thread is preemted before calling
setSurface, initSurface will assert, causing the app to crash.

Changed paths:
    backends/platform/android/org/scummvm/scummvm/ScummVM.java



diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVM.java b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
index 3a25b54..5047502 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVM.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
@@ -86,13 +86,15 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 		Log.d(LOG_TAG, String.format("surfaceChanged: %dx%d (%d)",
 										width, height, format));
 
+		// store values for the native code
+		// make sure to do it before notifying the lock
+		// as it leads to a race condition otherwise
+		setSurface(width, height);
+
 		synchronized(_sem_surface) {
 			_surface_holder = holder;
 			_sem_surface.notifyAll();
 		}
-
-		// store values for the native code
-		setSurface(width, height);
 	}
 
 	// SurfaceHolder callback


Commit: 0a00f2c91ab43e7d195856c8463e6b5e4d75486a
    https://github.com/scummvm/scummvm/commit/0a00f2c91ab43e7d195856c8463e6b5e4d75486a
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2014-02-15T08:54:26-08:00

Commit Message:
Merge pull request #432 from klusark/race

ANDROID: Fix a race condition

Changed paths:
    backends/platform/android/org/scummvm/scummvm/ScummVM.java









More information about the Scummvm-git-logs mailing list