Bug 1470260 - Part 1: Ensure that 'this' stays alive for the duration of the TickRefreshDriver call.

This commit is contained in:
wolfbeast 2018-09-10 22:12:07 +02:00 committed by Roy Tam
commit 6f120a942c

View file

@ -478,6 +478,9 @@ private:
bool NotifyVsync(TimeStamp aVsyncTimestamp) override
{
// IMPORTANT: All paths through this method MUST hold a strong ref on
// |this| for the duration of the TickRefreshDriver callback.
if (!NS_IsMainThread()) {
MOZ_ASSERT(XRE_IsParentProcess());
// Compress vsync notifications such that only 1 may run at a time
@ -498,6 +501,7 @@ private:
aVsyncTimestamp);
NS_DispatchToMainThread(vsyncEvent);
} else {
RefPtr<RefreshDriverVsyncObserver> kungFuDeathGrip(this);
TickRefreshDriver(aVsyncTimestamp);
}