Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: src/gpu/gl/GrGLTexture.cpp

Issue 19580003: Fix leak of GrGLTexID when its owning GrGLTexture has been abandoned. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/gpu/gl/GrGLRenderTarget.h ('K') | « src/gpu/gl/GrGLTexture.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLTexture.cpp
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index 6314b0c8f12e4d9be320c5cf4746250d468201c9..aee25bc0230f61bf624b65697de842eccc661f13 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -22,10 +22,9 @@ void GrGLTexture::init(GrGpuGL* gpu,
fTexParams.invalidate();
fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
- fTexIDObj = SkNEW_ARGS(GrGLTexID,
- (GPUGL->glInterface(),
- textureDesc.fTextureID,
- textureDesc.fIsWrapped));
+ fTexIDObj.reset(SkNEW_ARGS(GrGLTexID, (GPUGL->glInterface(),
+ textureDesc.fTextureID,
+ textureDesc.fIsWrapped)));
if (NULL != rtDesc) {
GrGLIRect vp;
@@ -53,22 +52,19 @@ GrGLTexture::GrGLTexture(GrGpuGL* gpu,
void GrGLTexture::onRelease() {
GPUGL->notifyTextureDelete(this);
- if (NULL != fTexIDObj) {
- fTexIDObj->unref();
- fTexIDObj = NULL;
- }
-
+ fTexIDObj.reset(NULL);
INHERITED::onRelease();
}
void GrGLTexture::onAbandon() {
- if (NULL != fTexIDObj) {
+ if (NULL != fTexIDObj.get()) {
fTexIDObj->abandon();
+ fTexIDObj.reset(NULL);
}
INHERITED::onAbandon();
}
GrBackendObject GrGLTexture::getTextureHandle() const {
- return fTexIDObj->id();
+ return static_cast<GrBackendObject>(this->textureID());
}
« src/gpu/gl/GrGLRenderTarget.h ('K') | « src/gpu/gl/GrGLTexture.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698