Bug 1282283 - Fix data race found by TSan. r?sewardj
MozReview-Commit-ID: FQofrD4S5iO
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -687,18 +687,21 @@ APZCTreeManager::ReceiveInputEvent(Input
}
bool hitScrollbar = false;
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(mouseInput.mOrigin,
&hitResult, &hitScrollbar);
// When the mouse is outside the window we still want to handle dragging
// but we won't find an APZC. Fallback to root APZC then.
- if (!apzc && mRootNode) {
- apzc = mRootNode->GetApzc();
+ { // scope lock
+ MutexAutoLock lock(mTreeLock);
+ if (!apzc && mRootNode) {
+ apzc = mRootNode->GetApzc();
+ }
}
if (apzc) {
bool targetConfirmed = (hitResult != HitNothing && hitResult != HitDispatchToContentRegion);
if (gfxPrefs::APZDragEnabled() && hitScrollbar) {
// If scrollbar dragging is enabled and we hit a scrollbar, wait
// for the main-thread confirmation because it contains drag metrics
// that we need.