changeset 3703:810445ab3099

6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI Reviewed-by: bae, flar
author prr
date Fri, 18 Feb 2011 09:14:07 -0800
parents e45f7d50dbc9
children 5d8cfcb9a4e8
files src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp	Thu Feb 17 13:42:26 2011 +0300
+++ b/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp	Fri Feb 18 09:14:07 2011 -0800
@@ -107,8 +107,16 @@
         // could retain their own DIB info and we would not need to
         // recreate it every time.
 
+        // GetRasInfo implicitly calls GetPrimitiveArrayCritical
+        // and since GetDC uses JNI it needs to be called first.
+        HDC hDC = dstOps->GetDC(env, dstOps, 0, NULL, clip, NULL, 0);
+        if (hDC == NULL) {
+            SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
+            return;
+        }
         srcOps->GetRasInfo(env, srcOps, &srcInfo);
         if (srcInfo.rasBase == NULL) {
+            dstOps->ReleaseDC(env, dstOps, hDC);
             SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
             return;
         }
@@ -174,13 +182,6 @@
             bmi.colors.dwMasks[2] = bmask;
         }
 
-        HDC hDC = dstOps->GetDC(env, dstOps, 0, NULL, clip, NULL, 0);
-        if (hDC == NULL) {
-            SurfaceData_InvokeRelease(env, srcOps, &srcInfo);
-            SurfaceData_InvokeUnlock(env, srcOps, &srcInfo);
-            return;
-        }
-
         if (fastBlt) {
             // Window could go away at any time, leaving bits on the screen
             // from this GDI call, so make sure window still exists