diff options
author | 2011-10-28 19:50:21 +0000 | |
---|---|---|
committer | 2011-10-28 19:50:21 +0000 | |
commit | 4a018bb20bf969a38ec11d9506843f06366dfa7c (patch) | |
tree | a7789f10f6d374adfbde9a9a2dab6f00923295c1 /src/gpu | |
parent | 7b1ca8c66e0bf20d3c0217faf0a733c1e16c1042 (diff) |
Fix pure virtual call from destructor and turn VertBench back on
git-svn-id: http://skia.googlecode.com/svn/trunk@2556 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrDrawTarget.cpp | 11 | ||||
-rw-r--r-- | src/gpu/GrDrawTarget.h | 4 | ||||
-rw-r--r-- | src/gpu/GrGpuGL.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrInOrderDrawBuffer.cpp | 2 |
4 files changed, 17 insertions, 2 deletions
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index 97ec3ba971..f60484572c 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -430,13 +430,20 @@ GrDrawTarget::GrDrawTarget() { } GrDrawTarget::~GrDrawTarget() { + GrAssert(1 == fGeoSrcStateStack.count()); + GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); + GrAssert(kNone_GeometrySrcType == geoSrc.fIndexSrc); + GrAssert(kNone_GeometrySrcType == geoSrc.fVertexSrc); +} + +void GrDrawTarget::releaseGeometry() { int popCnt = fGeoSrcStateStack.count() - 1; while (popCnt) { this->popGeometrySource(); --popCnt; } - this->releasePreviousVertexSource(); - this->releasePreviousIndexSource(); + this->resetVertexSource(); + this->resetIndexSource(); } void GrDrawTarget::setClip(const GrClip& clip) { diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h index 16326a9ba1..7d311aa2ec 100644 --- a/src/gpu/GrDrawTarget.h +++ b/src/gpu/GrDrawTarget.h @@ -1366,6 +1366,10 @@ protected: Caps fCaps; + // subclasses must call this in their destructors to ensure all vertex + // and index sources have been released (including those held by + // pushGeometrySource()) + void releaseGeometry(); private: // called when setting a new vert/idx source to unref prev vb/ib void releasePreviousVertexSource(); diff --git a/src/gpu/GrGpuGL.cpp b/src/gpu/GrGpuGL.cpp index 012fdc1acb..78655929f3 100644 --- a/src/gpu/GrGpuGL.cpp +++ b/src/gpu/GrGpuGL.cpp @@ -309,6 +309,8 @@ GrGpuGL::GrGpuGL(const GrGLInterface* gl, GrGLBinding glBinding) { } GrGpuGL::~GrGpuGL() { + // This must be called by before the GrDrawTarget destructor + this->releaseGeometry(); // This subclass must do this before the base class destructor runs // since we will unref the GrGLInterface. this->releaseResources(); diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index db20846225..837d2c1db9 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -44,6 +44,8 @@ GrInOrderDrawBuffer::GrInOrderDrawBuffer(const GrGpu* gpu, GrInOrderDrawBuffer::~GrInOrderDrawBuffer() { this->reset(); + // This must be called by before the GrDrawTarget destructor + this->releaseGeometry(); GrSafeUnref(fQuadIndexBuffer); } |