Guard resource provider path creation methods against abandoned context
Change-Id: Idb447352d1c39b14137e8bb5af4f3c8fd7378750
Reviewed-on: https://skia-review.googlesource.com/49767
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 7e7fef4..933f732 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -352,12 +352,20 @@
int GrResourceProvider::QuadCountOfQuadBuffer() { return kMaxQuads; }
sk_sp<GrPath> GrResourceProvider::createPath(const SkPath& path, const GrStyle& style) {
+ if (this->isAbandoned()) {
+ return nullptr;
+ }
+
SkASSERT(this->gpu()->pathRendering());
return this->gpu()->pathRendering()->createPath(path, style);
}
sk_sp<GrPathRange> GrResourceProvider::createPathRange(GrPathRange::PathGenerator* gen,
const GrStyle& style) {
+ if (this->isAbandoned()) {
+ return nullptr;
+ }
+
SkASSERT(this->gpu()->pathRendering());
return this->gpu()->pathRendering()->createPathRange(gen, style);
}