简体   繁体   English

Java JNA WindowProc JVM崩溃

[英]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. 在上一个问题中,我想实现WndProc来处理WM_DEVICECHANGE消息,以便知道何时连接或断开USB设备。

I managed to solve this issue, but .... in some cases the JVM crashes with the followin ugly error message: 我设法解决了这个问题,但是....在某些情况下,JVM崩溃并显示以下丑陋的错误消息:

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  0x1000cb77

     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. 我发现,只有在插入USB设备后迅速关闭机架,它才会使JVM崩溃,因此可能是消息处理不正确。 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. 在错误消息中,它说有一个“问题框架”,所以可能是我处理WM_DEVICECHANGE消息的隐藏静态窗口导致崩溃,但是我不确定。

So my question is what can be done in this situation, or what could cause the JVM crash. 所以我的问题是在这种情况下可以做什么,或者什么可能导致JVM崩溃。 Any suggestions are welcome. 欢迎任何建议。

Regards, Gabor 问候,Gabor

The problematic frame refers to a stack frame (ie a running method). 有问题的框架是指堆栈框架(即运行方法)。 It does not refer to a window ( java.awt.Frame or javax.swing.JFrame ). 不是指一个窗口( java.awt.Framejavax.swing.JFrame )。

Does closing your window somehow interact with the JNI code? 关闭窗口是否以某种方式与JNI代码交互?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM