Index: src/gpu/GrGpuResource.cpp |
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp |
index f8cb529314daa6b963d080755047bf82a2911576..a227fd2c0f5ad81ece6dda893a43aa621310cd75 100644 |
--- a/src/gpu/GrGpuResource.cpp |
+++ b/src/gpu/GrGpuResource.cpp |
@@ -46,6 +46,9 @@ void GrGpuResource::release() { |
} |
void GrGpuResource::abandon() { |
+ if (this->wasDestroyed()) { |
+ return; |
+ } |
SkASSERT(fGpu); |
this->onAbandon(); |
get_resource_cache(fGpu)->resourceAccess().removeResource(this); |
@@ -104,6 +107,9 @@ void GrGpuResource::didChangeGpuMemorySize() const { |
} |
void GrGpuResource::removeUniqueKey() { |
+ if (this->wasDestroyed()) { |
+ return; |
+ } |
SkASSERT(fUniqueKey.isValid()); |
get_resource_cache(fGpu)->resourceAccess().removeUniqueKey(this); |
} |
@@ -177,14 +183,15 @@ void GrGpuResource::removeScratchKey() { |
} |
void GrGpuResource::makeBudgeted() { |
- if (GrGpuResource::kUncached_LifeCycle == fLifeCycle) { |
+ if (!this->wasDestroyed() && GrGpuResource::kUncached_LifeCycle == fLifeCycle) { |
fLifeCycle = kCached_LifeCycle; |
get_resource_cache(fGpu)->resourceAccess().didChangeBudgetStatus(this); |
} |
} |
void GrGpuResource::makeUnbudgeted() { |
- if (GrGpuResource::kCached_LifeCycle == fLifeCycle && !fUniqueKey.isValid()) { |
+ if (!this->wasDestroyed() && GrGpuResource::kCached_LifeCycle == fLifeCycle && |
+ !fUniqueKey.isValid()) { |
fLifeCycle = kUncached_LifeCycle; |
get_resource_cache(fGpu)->resourceAccess().didChangeBudgetStatus(this); |
} |