aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rw-r--r--src/gpu/GrContext.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 80dd25ebee..e0307f5e19 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -69,6 +69,12 @@ GrContext* GrContext::Create(GrEngine engine,
GrContext::~GrContext() {
this->flush();
+ // the context's drawstate can be holding onto texture/render target refs.
+ // Relinquish them before the texture cache is freed lest a cached
+ // texture/RT not be freed in the right order
+ fDrawState->reset();
+ // The gpu refs textures in its drawstate.
+ fGpu->setDrawState(NULL);
// Since the gpu can hold scratch textures, give it a chance to let go
// of them before freeing the texture cache
fGpu->purgeResources();