mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 22:37:50 +00:00
Bug 1433855 - Make sure plugin function broker's PostToDispatchThread is Waiting before Notifying it. r=jimm
The Monitor's condition variable could be notified before the calling thread had begun to Wait for it. This caused the Notify to be missed, leading to hangs. By grabbing the Monitor in PostToDispatchHelper, we know Wait has been called because, otherwise, the calling thread would still hold the Monitor.
This commit is contained in:
parent
67e80b725b
commit
c6dc5f3406
@ -1269,6 +1269,12 @@ protected:
|
||||
// Note: p is also non-null... its just hard to assert that.
|
||||
MOZ_ASSERT(bmhi && monitor && ok && winErr && r);
|
||||
*ok = bmhi->BrokerCallClient(*winErr, *r, *p...);
|
||||
{
|
||||
// By grabbing (and freeing) the lock, we make sure that Wait() has been
|
||||
// called in PostToDispatchThread. We need that since we wake it with
|
||||
// Notify().
|
||||
MonitorAutoLock lock(*monitor);
|
||||
}
|
||||
*ok &= NS_SUCCEEDED(monitor->Notify());
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user