egl: Do not call drv->Initialize with global mutex locked.
authorChia-I Wu <olv@lunarg.com>
Thu, 24 Jun 2010 08:49:40 +0000 (16:49 +0800)
committerChia-I Wu <olv@lunarg.com>
Tue, 29 Jun 2010 09:16:20 +0000 (17:16 +0800)
src/egl/main/egldriver.c

index 71d2ba06d5031ba7830d34eaf4a2ca82b12eb51b..f3a69409c778db4716a9e8def94188b86e5c3e83 100644 (file)
@@ -460,6 +460,7 @@ _EGLDriver *
 _eglLoadDefaultDriver(EGLDisplay dpy, EGLint *major, EGLint *minor)
 {
    _EGLDriver *drv = NULL;
+   EGLBoolean ok;
    int i;
 
    _eglLockMutex(_eglGlobal.Mutex);
@@ -470,10 +471,15 @@ _eglLoadDefaultDriver(EGLDisplay dpy, EGLint *major, EGLint *minor)
       if (_eglGlobal.NumDrivers == 0)
         continue;
       drv = _eglGlobal.Drivers[0];
-      if (drv->API.Initialize(drv, dpy, major, minor))
-        break;
+
+      _eglUnlockMutex(_eglGlobal.Mutex);
+      ok = drv->API.Initialize(drv, dpy, major, minor);
+      _eglLockMutex(_eglGlobal.Mutex);
+      if (ok)
+         break;
+
       _eglUnloadDrivers();
-   }      
+   }
 
    _eglUnlockMutex(_eglGlobal.Mutex);