bug 738198 - crash in nsPluginInstanceOwner::~nsPluginInstanceOwner r=snorp

This commit is contained in:
Brad Lassey 2012-03-27 01:31:57 -04:00
parent 35ccf59a89
commit bb82c56da5
3 changed files with 16 additions and 11 deletions

View File

@ -1815,17 +1815,7 @@ void nsPluginInstanceOwner::RemovePluginView()
if (!surface)
return;
JNIEnv* env = GetJNIForThread();
if (!env)
return;
AndroidBridge::AutoLocalJNIFrame frame(env, 1);
jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
jmethodID method = env->GetStaticMethodID(cls,
"removePluginView",
"(Landroid/view/View;)V");
env->CallStaticVoidMethod(cls, method, surface);
AndroidBridge::RemovePluginView(surface);
}
void nsPluginInstanceOwner::Invalidate() {

View File

@ -165,6 +165,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
jEnableBatteryNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableBatteryNotifications", "()V");
jDisableBatteryNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "disableBatteryNotifications", "()V");
jGetCurrentBatteryInformation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getCurrentBatteryInformation", "()[D");
jRemovePluginView = jEnv->GetStaticMethodID(jGeckoAppShellClass, "removePluginView", "(Landroid/view/View;)V");
jGetAccessibilityEnabled = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getAccessibilityEnabled", "()Z");
jHandleGeckoMessage = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "handleGeckoMessage", "(Ljava/lang/String;)Ljava/lang/String;");
@ -2143,6 +2144,17 @@ NS_IMETHODIMP nsAndroidBridge::SetBrowserApp(nsIAndroidBrowserApp *aBrowserApp)
return NS_OK;
}
void
AndroidBridge::RemovePluginView(void* surface) {
JNIEnv *env = AndroidBridge::GetJNIEnv();
if (!env)
return;
AndroidBridge::AutoLocalJNIFrame frame(env, 1);
env->CallStaticVoidMethod(sBridge->mGeckoAppShellClass,
sBridge->jRemovePluginView, surface);
}
extern "C"
__attribute__ ((visibility("default")))
jobject JNICALL

View File

@ -181,6 +181,8 @@ public:
static void NotifyIMEChange(const PRUnichar *aText, PRUint32 aTextLen, int aStart, int aEnd, int aNewEnd);
static void RemovePluginView(void* surface);
nsresult TakeScreenshot(nsIDOMWindow *window, PRInt32 srcX, PRInt32 srcY, PRInt32 srcW, PRInt32 srcH, PRInt32 dstW, PRInt32 dstH, PRInt32 tabId, float scale);
void AcknowledgeEventSync();
@ -526,6 +528,7 @@ protected:
jmethodID jCheckUriVisited;
jmethodID jMarkUriVisited;
jmethodID jEmitGeckoAccessibilityEvent;
jmethodID jRemovePluginView;
jmethodID jNumberOfMessages;
jmethodID jSendMessage;