Prevent calling GL functions with an invalid surface

When destroying CanvasContext, the surface can be invalid
state. So the surface should be updated to null prior to
destroying GL resources to ensure that GL functions
are not called with an invalid surface.
Some GL implementation makes an error if GL functions
are called with an invalid surface. (Adreno 3xx)

Change-Id: Ie6f6ea081ec931fc9df30b2c3ed066ec1ae9d294
This commit is contained in:
Sangkyu Lee
2014-11-21 18:05:41 +09:00
parent f926d71b8e
commit f76d36f96b

View File

@@ -59,6 +59,7 @@ CanvasContext::~CanvasContext() {
void CanvasContext::destroy() {
stopDrawing();
setSurface(NULL);
freePrefetechedLayers();
destroyHardwareResources();
mAnimationContext->destroy();
@@ -66,7 +67,6 @@ void CanvasContext::destroy() {
delete mCanvas;
mCanvas = 0;
}
setSurface(NULL);
}
void CanvasContext::setSurface(ANativeWindow* window) {