diff options
author | John Reck <jreck@google.com> | 2012-08-08 17:27:13 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2012-08-08 17:27:13 -0700 |
commit | ddb9860fb5d82fbf1a96746d26d1b7b39a8ef8a2 (patch) | |
tree | 923ea443f97b12589780dc458bf075814ec5e0d9 /Source/WebCore/platform/graphics/android/context | |
parent | ebebc5e52683c447aef50606d0418d8de629d60a (diff) | |
download | external_webkit-ddb9860fb5d82fbf1a96746d26d1b7b39a8ef8a2.zip external_webkit-ddb9860fb5d82fbf1a96746d26d1b7b39a8ef8a2.tar.gz external_webkit-ddb9860fb5d82fbf1a96746d26d1b7b39a8ef8a2.tar.bz2 |
Fix memory leak
Bug: 6952980
GraphicsContext::createOffscreenContext creates an instance of both
PlatformGraphicsSkia and GraphicsContext for ImageBuffer. However,
ImageBuffer will only call delete on the GraphicsContext. In normal
GC usage, the PlatformGraphicsContext's lifecycle is longer than the
GCs, and is cleaned up by itself. This will result in leaking the
PlatformGraphicsSkia context, though. We need to make sure to call
delete on the PlatformGraphicsSkia context if we were initialized
with the deleteUs() flag, which is used to indicate just this scenario.
Change-Id: I73aa623182a039bd75d378d198cc3bd2d4d185ef
Diffstat (limited to 'Source/WebCore/platform/graphics/android/context')
-rw-r--r-- | Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp b/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp index 970b04b..23b22e6 100644 --- a/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp @@ -57,6 +57,12 @@ class GraphicsContextPlatformPrivate { public: GraphicsContextPlatformPrivate(PlatformGraphicsContext* platformContext) : m_context(platformContext) { } + ~GraphicsContextPlatformPrivate() + { + if (m_context->deleteUs()) + delete m_context; + } + PlatformGraphicsContext* context() { return m_context; } |