Bug 1330755 - Properly release the window device context. r?jimm
MozReview-Commit-ID: 7Y3p4g3yI3s
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1418,17 +1418,20 @@ nsWindow::CreateScrollSnapshot()
}
// Check that the window is in a position to snapshot. We don't check for
// clipped width as that doesn't currently matter for APZ scrolling.
if (clip.top || clip.bottom != mBounds.height) {
return GetFallbackScrollSnapshot(clip);
}
- nsAutoHDC windowDC(::GetDC(mWnd));
+ HDC windowDC = ::GetDC(mWnd);
+ auto releaseDC = MakeScopeExit([&] {
+ ::ReleaseDC(mWnd, windowDC);
+ });
if (!windowDC) {
return GetFallbackScrollSnapshot(clip);
}
gfx::IntSize snapshotSize(mBounds.width, mBounds.height);
ScrollSnapshot* snapshot;
if (clip.left || clip.right != mBounds.width) {
// Can't do a full snapshot, so use the partial snapshot.