6857592: Getting warning while moving or resizing the frame when component.printAll() is called on local JNI
Reviewed-by: bae, flar
--- 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