Bug 1330755 - Follow-up to move the MakeScopeExit to after the null check. r?bobowen draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 17 Jan 2017 10:45:30 -0500
changeset 462491 8f3b547317244af01f1ad0baea6056b581aca41a
parent 462490 7a4f03169c77e4618312be942f7c5fa17f7bcb68
child 542414 32b84ab4a4001a2807d11431a366272d1cf433ff
push id41773
push userkgupta@mozilla.com
push dateTue, 17 Jan 2017 15:46:01 +0000
reviewersbobowen
bugs1330755
milestone53.0a1
Bug 1330755 - Follow-up to move the MakeScopeExit to after the null check. r?bobowen MozReview-Commit-ID: GrRU0Efh0Ns
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1419,22 +1419,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);