Bug 529 - GLWindow.requestFocus() causes a crash of the JVM on Linux
Summary: GLWindow.requestFocus() causes a crash of the JVM on Linux
Status: RESOLVED FIXED
Alias: None
Product: Newt
Classification: JogAmp
Component: x11 (show other bugs)
Version: 1
Hardware: All linux
: --- major
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2011-11-14 13:29 CET by Julien Gouesse
Modified: 2011-12-02 12:29 CET (History)
0 users

See Also:
Type: ---
SCM Refs:
035051a686b7652dd14c0a878ebe1fe29f5f11c3
Workaround: ---


Attachments
log file (32.57 KB, text/x-log)
2011-11-14 13:29 CET, Julien Gouesse
Details
log file, crash reproduced on Cent OS 5.3 (35.67 KB, text/x-log)
2011-12-01 13:39 CET, Julien Gouesse
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Gouesse 2011-11-14 13:29:19 CET
Created attachment 294 [details]
log file

GLWindow.requestFocus() causes a crash of the JVM on Linux. I use Mageia Linux 1, KDE 4.6, the dev build 535 of JOGL 2.0, OpenJDK 1.6, AMD
Sempron 2600+ (32 bits), NVIDIA Geforce 7600 GT. The bug is reproducible on
Cent OS Linux 5.3 with Intel core duo and NVIDIA Quadro FX 3600 as you can see below:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x8f89d454, pid=28145, tid=2404363120
#
# JRE version: 6.0_22-b22
# Java VM: OpenJDK Client VM (20.0-b11 mixed mode linux-x86 )
# Derivative: IcedTea6 1.10.2
# Distribution: Mageia 1, package fedora-14.b22.5.1.mga1-i386
# Problematic frame:
# C  [libX11.so.6+0x1f454]  XGetInputFocus+0x14
#
# An error report file with more information is saved as:
# /home/gouessej/Documents/programmation/java/workspace/ardor3d-examples/hs_err_pid28145.log
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
#   http://icedtea.classpath.org/bugzilla
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#


Please find enclosed the log file. The crash happens in Java_jogamp_newt_driver_x11_X11Window_requestFocus0 on the call of XGetInputFocus.
Comment 1 Sven Gothel 2011-11-25 03:35:37 CET
All test passed on CentOS 6, see bug 451, comment 3.

If the bug still exist, please create a unit test, which I can reproduce on Ubuntu, CentOS 6 or Solaris.
Comment 2 Julien Gouesse 2011-12-01 13:39:00 CET
Hi

Add this into TestGearsES2NEWT just before calling glWindow.setVisible(true); and Cent OS 5.3 crashes:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000003f8642c546, pid=18982, tid=1113909568
#
# JRE version: 6.0_17-b17
# Java VM: OpenJDK 64-Bit Server VM (14.0-b16 mixed mode linux-amd64 )
# Derivative: IcedTea6 1.7.5
# Distribution: Custom build (Wed Oct 13 13:04:40 EDT 2010)
# Problematic frame:
# C  [libX11.so.6+0x2c546]  XGetInputFocus+0x16
#
# An error report file with more information is saved as:
# /users/TA/gouesse/git/jogl/make/hs_err_pid18982.log
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
#   http://icedtea.classpath.org/bugzilla
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Comment 3 Julien Gouesse 2011-12-01 13:39:57 CET
Created attachment 298 [details]
log file, crash reproduced on Cent OS 5.3
Comment 4 Julien Gouesse 2011-12-01 13:53:09 CET
I have found the root cause of this bug. If GLWindow.requestFocus() is called when GLWindow.isRealized() == false, it crashes. In my humble opinion, a check should be added in this method or the documentation should mention that requestFocus() must not be called when the window is not realized. I reopen this bug report but the fix is quite obvious anyway.
Comment 5 Sven Gothel 2011-12-01 17:17:04 CET
Fixed in commit 035051a686b7652dd14c0a878ebe1fe29f5f11c3 (will be pushed soon).

Thx Julien for being persistent and finding the culprit. Hope it works this way now.

--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1576,7 +1576,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
     }
 
     public void requestFocus(boolean wait) {
-        if(!focusAction()) {
+        if(isNativeValid() && !focusAction()) {
             runOnEDTIfAvail(wait, requestFocusAction);
         }
     }
Comment 6 Julien Gouesse 2011-12-02 12:29:15 CET
You're welcome. I confirm it works now.