resolved conflicts for merge of 4e3fadd0 to eclair-mr2
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index cbe5be4..f11123e 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -1299,9 +1299,16 @@
 
             GLThread oldThread = null;
             synchronized(this) {
-                mMostRecentGLThread = thread;
                 oldThread = mMostRecentGLThread;
+                mMostRecentGLThread = thread;
+            }
+            if (oldThread != null && ! mMultipleGLESContextsAllowed) {
+                synchronized(oldThread) {
+                    oldThread.notifyAll();
+                }
+            }
 
+            synchronized(this) {
                 while ((! mMultipleGLESContextsAllowed)
                         && mGLContextCount > 0) {
                     wait();
@@ -1309,12 +1316,6 @@
 
                 mGLContextCount++;
             }
-
-            if (oldThread != null && ! mMultipleGLESContextsAllowed) {
-                synchronized(oldThread) {
-                    oldThread.notifyAll();
-                }
-            }
         }
 
         public synchronized void end(GLThread thread) {