From e640a52207b76266524d53397a8d4047aacac2de Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 18 Feb 2011 09:14:07 -0800 Subject: [PATCH] 6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI Reviewed-by: bae, flar --- .../native/sun/java2d/windows/GDIBlitLoops.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp b/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp index d9d2a000b96..d3dc21dae14 100644 --- a/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp +++ b/jdk/src/windows/native/sun/java2d/windows/GDIBlitLoops.cpp @@ -107,8 +107,16 @@ Java_sun_java2d_windows_GDIBlitLoops_nativeBlit // 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 @@ Java_sun_java2d_windows_GDIBlitLoops_nativeBlit 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