Removed access of freed memory in GrContext dtor

http://codereview.appspot.com/6488111/



git-svn-id: http://skia.googlecode.com/svn/trunk@5479 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 4599990..b9314c8 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -95,6 +95,7 @@
     fGpu->purgeResources();
 
     delete fTextureCache;
+    fTextureCache = NULL;
     delete fFontCache;
     delete fDrawBuffer;
     delete fDrawBufferVBAllocPool;
@@ -495,7 +496,9 @@
 }
 
 void GrContext::purgeCache() {
-    fTextureCache->purgeAsNeeded();
+    if (NULL != fTextureCache) {
+        fTextureCache->purgeAsNeeded();
+    }
 }
 
 GrTexture* GrContext::createUncachedTexture(const GrTextureDesc& descIn,