Commit 9af8414b authored by aroben@apple.com's avatar aroben@apple.com
Browse files

Fix an HRGN leak in WKCACFLayerRenderer

Fixes <http://webkit.org/b/39312> <rdar://problem/7998728> REGRESSION
(r53686-r55990): Graphics corruption when watching video (affects
youtube.com)

Reviewed by Darin Adler.

* platform/graphics/win/WKCACFLayerRenderer.cpp:
(WebCore::getDirtyRects): Use an OwnPtr to hold the HRGN we allocate.
That way we don't have to remember to destroy it (as we were
forgetting to do) when we bail out of this function early.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@59864 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 544432d4
2010-05-20 Adam Roben <aroben@apple.com>
Fix an HRGN leak in WKCACFLayerRenderer
Fixes <http://webkit.org/b/39312> <rdar://problem/7998728> REGRESSION
(r53686-r55990): Graphics corruption when watching video (affects
youtube.com)
Reviewed by Darin Adler.
* platform/graphics/win/WKCACFLayerRenderer.cpp:
(WebCore::getDirtyRects): Use an OwnPtr to hold the HRGN we allocate.
That way we don't have to remember to destroy it (as we were
forgetting to do) when we bail out of this function early.
2010-05-20 Darin Fisher <darin@chromium.org>
 
Reviewed by Nate Chapin.
......@@ -460,8 +460,8 @@ static void getDirtyRects(HWND window, Vector<CGRect>& outRects)
if (!GetClientRect(window, &clientRect))
return;
HRGN region = CreateRectRgn(0, 0, 0, 0);
int regionType = GetUpdateRgn(window, region, false);
OwnPtr<HRGN> region(CreateRectRgn(0, 0, 0, 0));
int regionType = GetUpdateRgn(window, region.get(), false);
if (regionType != COMPLEXREGION) {
RECT dirtyRect;
if (GetUpdateRect(window, &dirtyRect, false))
......@@ -469,10 +469,10 @@ static void getDirtyRects(HWND window, Vector<CGRect>& outRects)
return;
}
DWORD dataSize = GetRegionData(region, 0, 0);
DWORD dataSize = GetRegionData(region.get(), 0, 0);
OwnArrayPtr<unsigned char> regionDataBuffer(new unsigned char[dataSize]);
RGNDATA* regionData = reinterpret_cast<RGNDATA*>(regionDataBuffer.get());
if (!GetRegionData(region, dataSize, regionData))
if (!GetRegionData(region.get(), dataSize, regionData))
return;
outRects.resize(regionData->rdh.nCount);
......@@ -480,8 +480,6 @@ static void getDirtyRects(HWND window, Vector<CGRect>& outRects)
RECT* rect = reinterpret_cast<RECT*>(regionData->Buffer);
for (size_t i = 0; i < outRects.size(); ++i, ++rect)
outRects[i] = winRectToCGRect(*rect, clientRect);
DeleteObject(region);
}
void WKCACFLayerRenderer::renderTimerFired(Timer<WKCACFLayerRenderer>*)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment