Java JNA WindowProc JVM Crash
In a previous question I wanted to implement the WndProc
to handle the WM_DEVICECHANGE
message in order to know when my USB device is attached or detached.
I managed to solve this issue, but .... in some cases the JVM crashes with the followin ugly error message:
A fatal error has been detected by the Java Runtime Environment: EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x1000cb77, pid=3448, tid=4432 JRE version: 6.0_17-b04 Java VM: Java HotSpot(TM) Client VM (14.3-b01 mixed mode, sharing windows-x86 ) Problematic frame: C 0x开发者_如何学编程1000cb77 If you would like to submit a bug report, please visit: http://java.sun.com/webapps/bugreport/crash.jsp The crash happened outside the Java Virtual Machine in native code. See problematic frame for where to report the bug.
I found that it only crashes the JVM if I close my frame quickly after inserting my USB device, so probably the message isn't handled properly. In the error message it says that there is a "problematic frame", so probably my hidden static window, that handles the WM_DEVICECHANGE message causes the crash, but I'm not sure.
So my question is what can be done in this situation, or what could cause the JVM crash. Any suggestions are welcome.
Regards, Gabor
The problematic frame refers to a stack frame (i.e. a running method). It does not refer to a window (java.awt.Frame
or javax.swing.JFrame
).
Does closing your window somehow interact with the JNI code?
精彩评论