Bug 1330755 - Follow-up to move the MakeScopeExit to after the null check. r=bobowen, a=jcristau
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 17 Jan 2017 10:57:06 -0500
changeset 353722 3c1334c6b10e98e9aab01ec6bc083f5dc6d80857
parent 353721 69f54dcd72c6f5b5ae1279a381727f05004d3cc1
child 353723 7585202b140097211e05bebbb39cfcfc7c0c7a8e
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbobowen, jcristau
bugs1330755
milestone52.0a2
Bug 1330755 - Follow-up to move the MakeScopeExit to after the null check. r=bobowen, a=jcristau MozReview-Commit-ID: GrRU0Efh0Ns
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1412,22 +1412,22 @@ 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);
   }
 
   HDC windowDC = ::GetDC(mWnd);
+  if (!windowDC) {
+    return GetFallbackScrollSnapshot(clip);
+  }
   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.
     snapshot = EnsureSnapshotSurface(mPartialSnapshot, snapshotSize);
   } else {
     snapshot = EnsureSnapshotSurface(mFullSnapshot, snapshotSize);