| Index: src/core/SkPathRef.cpp
|
| diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
|
| index b83a4513765d84eba44a644bf65ee0f71939c1cf..161eb804199ba2f7e96d03d4a926819bdaaf99f1 100644
|
| --- a/src/core/SkPathRef.cpp
|
| +++ b/src/core/SkPathRef.cpp
|
| @@ -28,15 +28,17 @@ SkPathRef::Editor::Editor(SkAutoTUnref<SkPathRef>* pathRef,
|
| }
|
|
|
| //////////////////////////////////////////////////////////////////////////////
|
| -void SkPathRef::CreateEmptyImpl(SkPathRef** empty) {
|
| - *empty = SkNEW(SkPathRef);
|
| - (*empty)->computeBounds(); // Preemptively avoid a race to clear fBoundsIsDirty.
|
| +static SkPathRef* gEmptyPathRef = NULL;
|
| +static void cleanup_gEmptyPathRef() { gEmptyPathRef->unref(); }
|
| +
|
| +void SkPathRef::CreateEmptyImpl(int) {
|
| + gEmptyPathRef = SkNEW(SkPathRef);
|
| + gEmptyPathRef->computeBounds(); // Preemptively avoid a race to clear fBoundsIsDirty.
|
| }
|
|
|
| SkPathRef* SkPathRef::CreateEmpty() {
|
| - static SkPathRef* gEmptyPathRef;
|
| SK_DECLARE_STATIC_ONCE(once);
|
| - SkOnce(&once, SkPathRef::CreateEmptyImpl, &gEmptyPathRef);
|
| + SkOnce(&once, SkPathRef::CreateEmptyImpl, 0, cleanup_gEmptyPathRef);
|
| return SkRef(gEmptyPathRef);
|
| }
|
|
|
|
|