From c870c7ade97d81fba369fe1447056f084de4e315 Mon Sep 17 00:00:00 2001 From: "edburns%acm.org" Date: Sat, 14 Jul 2001 00:03:17 +0000 Subject: [PATCH] bug=88053 r/sr=brendan This bug fix prevents the crash on exit with Java on win32. git-svn-id: svn://10.0.0.236/trunk@99247 18797224-902f-48f8-a5cc-f745e15eee43 --- .../plugin/base/src/nsPluginHostImpl.cpp | 18 ++++++++++++++++-- .../modules/plugin/nglsrc/nsPluginHostImpl.cpp | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index a4ecd6c9dcc..341a89bf76b 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -506,12 +506,26 @@ void nsActivePluginList::stopRunning() if(mFirst == nsnull) return; + PRBool doCallSetWindowAfterDestroy = PR_FALSE; + for(nsActivePlugin * p = mFirst; p != nsnull; p = p->mNext) { if(!p->mStopped && p->mInstance) { - p->mInstance->SetWindow(nsnull); - p->mInstance->Stop(); + // then determine if the plugin wants Destroy to be called after + // Set Window. This is for bug 50547. + p->mInstance->GetValue(nsPluginInstanceVariable_CallSetWindowAfterDestroyBool, + (void *) &doCallSetWindowAfterDestroy); + if (doCallSetWindowAfterDestroy) { + p->mInstance->Stop(); + p->mInstance->Destroy(); + p->mInstance->SetWindow(nsnull); + } + else { + p->mInstance->SetWindow(nsnull); + p->mInstance->Stop(); + } + doCallSetWindowAfterDestroy = PR_FALSE; p->setStopped(PR_TRUE); } } diff --git a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp index a4ecd6c9dcc..341a89bf76b 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -506,12 +506,26 @@ void nsActivePluginList::stopRunning() if(mFirst == nsnull) return; + PRBool doCallSetWindowAfterDestroy = PR_FALSE; + for(nsActivePlugin * p = mFirst; p != nsnull; p = p->mNext) { if(!p->mStopped && p->mInstance) { - p->mInstance->SetWindow(nsnull); - p->mInstance->Stop(); + // then determine if the plugin wants Destroy to be called after + // Set Window. This is for bug 50547. + p->mInstance->GetValue(nsPluginInstanceVariable_CallSetWindowAfterDestroyBool, + (void *) &doCallSetWindowAfterDestroy); + if (doCallSetWindowAfterDestroy) { + p->mInstance->Stop(); + p->mInstance->Destroy(); + p->mInstance->SetWindow(nsnull); + } + else { + p->mInstance->SetWindow(nsnull); + p->mInstance->Stop(); + } + doCallSetWindowAfterDestroy = PR_FALSE; p->setStopped(PR_TRUE); } }