From c018655c37a1da5d7e1f9dc94d0467130cf630f1 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine LaFayette Date: Wed, 10 Oct 2012 13:43:45 -0400 Subject: Fix for memory leak in WebGL CRs-fixed: 407009 (cherry-picked from commit 796a2a4cc637a3b04ee845e595b081e826207924) Change-Id: I584fe07dd5887ed52b74bc84044d510f8a2e2ba8 --- .../platform/graphics/android/GraphicsContext3DInternal.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Source/WebCore/platform/graphics/android/GraphicsContext3DInternal.cpp') diff --git a/Source/WebCore/platform/graphics/android/GraphicsContext3DInternal.cpp b/Source/WebCore/platform/graphics/android/GraphicsContext3DInternal.cpp index 85c9719..7855739 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsContext3DInternal.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsContext3DInternal.cpp @@ -170,8 +170,8 @@ GLint GraphicsContext3DInternal::checkGLError(const char* s) GraphicsContext3DInternal::GraphicsContext3DInternal(HTMLCanvasElement* canvas, GraphicsContext3D::Attributes attrs, HostWindow* hostWindow) - : m_proxy(new GraphicsContext3DProxy()) - , m_compositingLayer(new WebGLLayer(m_proxy.get())) + : m_proxy(adoptRef(new GraphicsContext3DProxy())) + , m_compositingLayer(new WebGLLayer(m_proxy)) , m_canvas(canvas) , m_attrs(attrs) , m_layerComposited(false) @@ -200,7 +200,6 @@ GraphicsContext3DInternal::GraphicsContext3DInternal(HTMLCanvasElement* canvas, } LOGWEBGL("GraphicsContext3DInternal() = %p, m_compositingLayer = %p", this, m_compositingLayer); - m_compositingLayer->ref(); m_proxy->setGraphicsContext(this); if (!m_canvas || !m_canvas->document() || !m_canvas->document()->view()) @@ -284,7 +283,7 @@ GraphicsContext3DInternal::~GraphicsContext3DInternal() m_proxy->setGraphicsContext(0); MutexLocker lock(m_fboMutex); - m_compositingLayer->unref(); + SkSafeUnref(m_compositingLayer); m_compositingLayer = 0; deleteContext(true); -- cgit v1.1