# HG changeset patch # User prr # Date 1298049247 28800 # Node ID b2e3eb2cc841e28b84a6698b8a225c48dc1278e8 # Parent 39c22ace748d7a602180724ee2308a01294d7eb9 6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI Reviewed-by: bae, flar diff -r 39c22ace748d -r b2e3eb2cc841 jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp --- a/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp Thu Feb 17 13:42:26 2011 +0300 +++ b/jdk/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