mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 876270 - crash in mozilla::plugins::parent::_getvalue r=snorp
This commit is contained in:
parent
388caa55f4
commit
97bbee45a5
@ -2261,16 +2261,14 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
}
|
||||
|
||||
case kJavaContext_ANPGetValue: {
|
||||
LOG("get context");
|
||||
JNIEnv* env = GetJNIForThread();
|
||||
if (!env)
|
||||
AndroidBridge *bridge = AndroidBridge::Bridge();
|
||||
if (!bridge)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
||||
jobject ret = bridge->GetContext();
|
||||
if (!ret)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
|
||||
jclass cls = env->FindClass("org/mozilla/gecko/GeckoApp");
|
||||
jfieldID field = env->GetStaticFieldID(cls, "mAppContext",
|
||||
"Lorg/mozilla/gecko/GeckoApp;");
|
||||
jobject ret = env->GetStaticObjectField(cls, field);
|
||||
env->DeleteLocalRef(cls);
|
||||
int32_t* i = reinterpret_cast<int32_t*>(result);
|
||||
*i = reinterpret_cast<int32_t>(ret);
|
||||
return NPERR_NO_ERROR;
|
||||
|
@ -2062,6 +2062,22 @@ AndroidBridge::LockWindow(void *window, unsigned char **bits, int *width, int *h
|
||||
return true;
|
||||
}
|
||||
|
||||
jobject
|
||||
AndroidBridge::GetContext() {
|
||||
JNIEnv *env = GetJNIForThread();
|
||||
if (!env)
|
||||
return 0;
|
||||
|
||||
jobject context = env->CallStaticObjectMethod(mGeckoAppShellClass, jGetContext);
|
||||
if (env->ExceptionCheck()) {
|
||||
env->ExceptionDescribe();
|
||||
env->ExceptionClear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
jobject
|
||||
AndroidBridge::GetGlobalContextRef() {
|
||||
JNIEnv *env = GetJNIForThread();
|
||||
@ -2070,10 +2086,7 @@ AndroidBridge::GetGlobalContextRef() {
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
|
||||
jobject context = env->CallStaticObjectMethod(mGeckoAppShellClass, jGetContext);
|
||||
if (jniFrame.CheckForException()) {
|
||||
return 0;
|
||||
}
|
||||
jobject context = GetContext();
|
||||
|
||||
jobject globalRef = env->NewGlobalRef(context);
|
||||
MOZ_ASSERT(globalRef);
|
||||
|
@ -311,6 +311,9 @@ public:
|
||||
// DeleteGlobalRef() when the context is no longer needed.
|
||||
jobject GetGlobalContextRef(void);
|
||||
|
||||
// Returns a local reference. Caller must manage this reference
|
||||
jobject GetContext(void);
|
||||
|
||||
void UnlockBitmap(jobject bitmap);
|
||||
|
||||
bool UnlockProfile();
|
||||
|
Loading…
Reference in New Issue
Block a user