mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8346952: GetGraphicsStressTest.java fails: Native resources unavailable
Reviewed-by: serb
This commit is contained in:
parent
3bcbcc5747
commit
44cff9d6ab
@ -2498,32 +2498,22 @@ jint AwtWindow::_GetScreenImOn(void *param)
|
||||
|
||||
jobject self = (jobject)param;
|
||||
|
||||
// It's entirely possible that our native resources have been destroyed
|
||||
// before our java peer - if we're dispose()d, for instance.
|
||||
// Alert caller w/ IllegalComponentStateException.
|
||||
if (self == NULL) {
|
||||
JNU_ThrowByName(env, "java/awt/IllegalComponentStateException",
|
||||
"Peer null in JNI");
|
||||
return 0;
|
||||
}
|
||||
PDATA pData = JNI_GET_PDATA(self);
|
||||
if (pData == NULL) {
|
||||
JNU_ThrowByName(env, "java/awt/IllegalComponentStateException",
|
||||
"Native resources unavailable");
|
||||
env->DeleteGlobalRef(self);
|
||||
return 0;
|
||||
}
|
||||
jint result = -1;
|
||||
AwtWindow* window = NULL;
|
||||
|
||||
jint result = 0;
|
||||
AwtWindow *w = (AwtWindow *)pData;
|
||||
if (::IsWindow(w->GetHWnd()))
|
||||
// Our native resources may have been destroyed before the Java peer,
|
||||
// e.g., if dispose() was called. In that case, return the default screen.
|
||||
PDATA pData;
|
||||
JNI_CHECK_PEER_GOTO(self, ret);
|
||||
window = (AwtWindow *)pData;
|
||||
if (::IsWindow(window->GetHWnd()))
|
||||
{
|
||||
result = (jint)w->GetScreenImOn();
|
||||
result = (jint)window->GetScreenImOn();
|
||||
}
|
||||
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
|
||||
return result;
|
||||
return (result != -1) ? result : AwtWin32GraphicsDevice::GetDefaultDeviceIndex();
|
||||
}
|
||||
|
||||
void AwtWindow::_SetFocusableWindow(void *param)
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.awt.Window;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8346952
|
||||
* @summary Verifies no exception occurs when triggering updateCG()
|
||||
* for an ownerless window.
|
||||
* @key headful
|
||||
*/
|
||||
public final class BogusFocusableWindowState {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Window frame = new Window(null) {
|
||||
@Override
|
||||
public boolean getFocusableWindowState() {
|
||||
removeNotify();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
try {
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
} finally {
|
||||
frame.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8235638 8235739 8285094
|
||||
* @bug 8235638 8235739 8285094 8346952
|
||||
* @key headful
|
||||
*/
|
||||
public final class GetGraphicsStressTest {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user