Bug 763166 - Fix race condition that could result in using an uninitialized AndroidBridge. r=snorp

This commit is contained in:
Kartikaya Gupta 2012-07-31 17:34:06 -04:00
Родитель 083c6b4275
Коммит c1e342445b
2 изменённых файлов: 6 добавлений и 8 удалений

Просмотреть файл

@ -59,7 +59,7 @@ class AndroidRefable {
// This isn't in AndroidBridge.h because including StrongPointer.h there is gross
static android::sp<AndroidRefable> (*android_SurfaceTexture_getNativeWindow)(JNIEnv* env, jobject surfaceTexture) = nullptr;
AndroidBridge *
void
AndroidBridge::ConstructBridge(JNIEnv *jEnv,
jclass jGeckoAppShellClass)
{
@ -73,12 +73,11 @@ AndroidBridge::ConstructBridge(JNIEnv *jEnv,
PR_NewThreadPrivateIndex(&sJavaEnvThreadIndex, JavaThreadDetachFunc);
sBridge = new AndroidBridge();
if (!sBridge->Init(jEnv, jGeckoAppShellClass)) {
delete sBridge;
sBridge = 0;
AndroidBridge *bridge = new AndroidBridge();
if (!bridge->Init(jEnv, jGeckoAppShellClass)) {
delete bridge;
}
return sBridge;
sBridge = bridge;
}
bool

Просмотреть файл

@ -101,8 +101,7 @@ public:
LAYER_CLIENT_TYPE_GL = 2 // AndroidGeckoGLLayerClient
};
static AndroidBridge *ConstructBridge(JNIEnv *jEnv,
jclass jGeckoAppShellClass);
static void ConstructBridge(JNIEnv *jEnv, jclass jGeckoAppShellClass);
static AndroidBridge *Bridge() {
return sBridge;