summaryrefslogtreecommitdiffstats
path: root/content/plugin
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-29 00:54:20 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-29 00:54:20 +0000
commit1bfecd09376ef163d0eaf5fdcfb73dbb9e31c1bf (patch)
treeb0463dbaba5d3c7ee4b01ff8a6869015a173db88 /content/plugin
parent72c19697eb36c507eefd5882b9511e5f185cbd83 (diff)
downloadchromium_src-1bfecd09376ef163d0eaf5fdcfb73dbb9e31c1bf.zip
chromium_src-1bfecd09376ef163d0eaf5fdcfb73dbb9e31c1bf.tar.gz
chromium_src-1bfecd09376ef163d0eaf5fdcfb73dbb9e31c1bf.tar.bz2
Fix bad section object leak when painting plugins
The skia canvas does not own the section handle in: PlatformCanvas::initialize(x, y, true, section) so you have close it at some point. Since skia calls CreateDibSection in this fuction, which maps the memory, it is safe to close the handle after initialize. A test is being added to ui_tests to make sure we know if this works. BUG=31173 TEST= see http://codereview.chromium.org/7492074/ Review URL: http://codereview.chromium.org/7482047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94604 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/plugin')
-rw-r--r--content/plugin/webplugin_proxy.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc
index a54f73a..9b34568 100644
--- a/content/plugin/webplugin_proxy.cc
+++ b/content/plugin/webplugin_proxy.cc
@@ -469,16 +469,20 @@ void WebPluginProxy::CreateCanvasFromHandle(
// Create a canvas that will reference the shared bits. We have to handle
// errors here since we're mapping a large amount of memory that may not fit
// in our address space, or go wrong in some other way.
+ HANDLE section = chrome::GetSectionFromProcess(dib_handle,
+ channel_->renderer_handle(),
+ false);
scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas);
if (!canvas->initialize(
window_rect.width(),
window_rect.height(),
true,
- chrome::GetSectionFromProcess(dib_handle,
- channel_->renderer_handle(), false))) {
- canvas.reset();
+ section)) {
+ canvas_out->reset();
}
canvas_out->reset(canvas.release());
+ // The canvas does not own the section so we need to close it now.
+ CloseHandle(section);
}
void WebPluginProxy::SetWindowlessBuffers(