mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 536437 - work around a bug in the Mozilla plugin host where NPN_GetURLNotify can return an error and also call NPP_URLNotify, r=cjones
This commit is contained in:
parent
75601d4658
commit
ba2a2920c7
@ -270,6 +270,10 @@ PluginInstanceParent::AnswerPStreamNotifyConstructor(PStreamNotifyParent* actor,
|
||||
const bool& file,
|
||||
NPError* result)
|
||||
{
|
||||
bool streamDestroyed = false;
|
||||
static_cast<StreamNotifyParent*>(actor)->
|
||||
SetDestructionFlag(&streamDestroyed);
|
||||
|
||||
if (!post) {
|
||||
*result = mNPNIface->geturlnotify(mNPP,
|
||||
NullableStringGet(url),
|
||||
@ -285,8 +289,11 @@ PluginInstanceParent::AnswerPStreamNotifyConstructor(PStreamNotifyParent* actor,
|
||||
file, actor);
|
||||
}
|
||||
|
||||
if (*result != NPERR_NO_ERROR)
|
||||
PStreamNotifyParent::Call__delete__(actor, NPERR_GENERIC_ERROR);
|
||||
if (!streamDestroyed) {
|
||||
static_cast<StreamNotifyParent*>(actor)->ClearDestructionFlag();
|
||||
if (*result != NPERR_NO_ERROR)
|
||||
PStreamNotifyParent::Call__delete__(actor, NPERR_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -48,7 +48,26 @@ class StreamNotifyParent : public PStreamNotifyParent
|
||||
{
|
||||
friend class PluginInstanceParent;
|
||||
|
||||
StreamNotifyParent() { }
|
||||
StreamNotifyParent()
|
||||
: mDestructionFlag(NULL)
|
||||
{ }
|
||||
~StreamNotifyParent() {
|
||||
if (mDestructionFlag)
|
||||
*mDestructionFlag = true;
|
||||
}
|
||||
|
||||
public:
|
||||
// If we are destroyed within the call to NPN_GetURLNotify, notify the caller
|
||||
// so that we aren't destroyed again. see bug 536437.
|
||||
void SetDestructionFlag(bool* flag) {
|
||||
mDestructionFlag = flag;
|
||||
}
|
||||
void ClearDestructionFlag() {
|
||||
mDestructionFlag = NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
bool* mDestructionFlag;
|
||||
};
|
||||
|
||||
} // namespace plugins
|
||||
|
Loading…
Reference in New Issue
Block a user