nsCOMPtr<nsIPluginInstance> inst; mInstanceOwner->GetInstance(*getter_AddRefs(inst)); if(inst)
nsIPluginInstance *inst; mInstanceOwner->GetInstance(inst); if(inst != nsnull)
nsObjectFrame::Destroy(nsPresContext* aPresContext){  // we need to finish with the plugin before native window is destroyed  // doing this in the destructor is too late.  if(mInstanceOwner != nsnull)  {    nsCOMPtr<nsIPluginInstance> inst;    mInstanceOwner->GetInstance(*getter_AddRefs(inst));    if(inst)    {      nsPluginWindow *win;      mInstanceOwner->GetWindow(win);      nsPluginNativeWindow *window = (nsPluginNativeWindow *)win;      nsCOMPtr<nsIPluginInstance> nullinst;      PRBool doCache = PR_TRUE;      PRBool doCallSetWindowAfterDestroy = PR_FALSE;      // first, determine if the plugin wants to be cached      inst->GetValue(nsPluginInstanceVariable_DoCacheBool,                      (void *) &doCache);      if (!doCache) {        // then determine if the plugin wants Destroy to be called after        // Set Window.  This is for bug 50547.        inst->GetValue(nsPluginInstanceVariable_CallSetWindowAfterDestroyBool,                        (void *) &doCallSetWindowAfterDestroy);        if (doCallSetWindowAfterDestroy) {          inst->Stop();          inst->Destroy();                    if (window)             window->CallSetWindow(nullinst);          else             inst->SetWindow(nsnull);        }        else {          if (window)             window->CallSetWindow(nullinst);          else             inst->SetWindow(nsnull);          inst->Stop();          inst->Destroy();        }      }      else {        if (window)           window->CallSetWindow(nullinst);        else           inst->SetWindow(nsnull);        inst->Stop();      }      nsCOMPtr<nsIPluginHost> pluginHost = do_GetService(kCPluginManagerCID);      if(pluginHost)        pluginHost->StopPluginInstance(inst);      // the frame is going away along with its widget      // so tell the window to forget its widget too      if (window)        window->SetPluginWidget(nsnull);    }    mInstanceOwner->Destroy();    NS_RELEASE(mInstanceOwner);  }    return nsObjectFrameSuper::Destroy(aPresContext);}