Bug 800838 - Guard against invalid NPP when unscheduling plugin timers on Android r=blassey
This commit is contained in:
@@ -151,6 +151,8 @@ private:
|
||||
Mutex mLock;
|
||||
};
|
||||
|
||||
static std::map<NPP, nsNPAPIPluginInstance*> sPluginNPPMap;
|
||||
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
@@ -190,12 +192,20 @@ nsNPAPIPluginInstance::nsNPAPIPluginInstance()
|
||||
mNPP.ndata = this;
|
||||
|
||||
PLUGIN_LOG(PLUGIN_LOG_BASIC, ("nsNPAPIPluginInstance ctor: this=%p\n",this));
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
sPluginNPPMap[&mNPP] = this;
|
||||
#endif
|
||||
}
|
||||
|
||||
nsNPAPIPluginInstance::~nsNPAPIPluginInstance()
|
||||
{
|
||||
PLUGIN_LOG(PLUGIN_LOG_BASIC, ("nsNPAPIPluginInstance dtor: this=%p\n",this));
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
sPluginNPPMap.erase(&mNPP);
|
||||
#endif
|
||||
|
||||
if (mMIMEType) {
|
||||
PR_Free((void *)mMIMEType);
|
||||
mMIMEType = nullptr;
|
||||
@@ -1052,6 +1062,17 @@ void nsNPAPIPluginInstance::SetInverted(bool aInverted)
|
||||
mInverted = aInverted;
|
||||
}
|
||||
|
||||
nsNPAPIPluginInstance* nsNPAPIPluginInstance::GetFromNPP(NPP npp)
|
||||
{
|
||||
std::map<NPP, nsNPAPIPluginInstance*>::iterator it;
|
||||
|
||||
it = sPluginNPPMap.find(npp);
|
||||
if (it == sPluginNPPMap.end())
|
||||
return nullptr;
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
nsresult nsNPAPIPluginInstance::GetDrawingModel(int32_t* aModel)
|
||||
|
||||
Reference in New Issue
Block a user