From 80390ec0f5b5a07b7b3510a64a6efb5c9058a937 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Wed, 2 Oct 2013 16:42:58 +0000 Subject: Threads can race to be the first one to calculate the empty path ref's bounds. To dodge the problem, call computeBounds when creating the global empty path ref. There's still another race here, which is that we can race to create the empty path ref in the first place. As written we can conceivably allocate an arbitrary number of empty path refs, one of which ends up pointed to by the global variable at the end. I've punted on fixing this for now because 1) tsan has not complained yet; 2) I think it can be fixed by the same approach as we can fix the memsets in 25415003, so I want to wait to see how that review goes first. BUG= R=reed@google.com, robertphillips@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/25745003 git-svn-id: http://skia.googlecode.com/svn/trunk@11576 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkPathRef.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/core/SkPathRef.h b/include/core/SkPathRef.h index 97643d6eab..500fb4a34e 100644 --- a/include/core/SkPathRef.h +++ b/include/core/SkPathRef.h @@ -112,6 +112,7 @@ public: static SkPathRef* gEmptyPathRef; if (!gEmptyPathRef) { gEmptyPathRef = SkNEW(SkPathRef); // leak! + gEmptyPathRef->computeBounds(); // Premptively avoid a race to clear fBoundsIsDirty. } return SkRef(gEmptyPathRef); } -- cgit v1.2.3