Skip to main content

JVM throwing Access Violation exceptions all over the place

No replies
cowwoc
Offline
Joined: 2003-08-24
Points: 0

I'm launching Java6 update 11 from JNI in debug mode. I'm seeing this exception being thrown tens of times by the JVM:

First-chance exception at 0x027637f7 in DesktopBeautifier.exe: 0xC0000005: Access violation reading location 0x00000010

stack-trace:

027637f7()
jvm.dll!6d81ec29()
[Frames below may be incorrect and/or missing, no symbols loaded for jvm.dll]
[snip]

This only seems to happen after you close a modal JDialog. Here is a simple testcase:

import javax.swing.JDialog;
import javax.swing.JFrame;

public class Test<br />
{<br />
	public static void main(String[] args)<br />
	{<br />
		JDialog dialog = new JDialog((JFrame) null, true);<br />
		System.err.println("line1");<br />
		dialog.setVisible(true);<br />
		System.err.println("line2"); // program will crash right before this line<br />
	}<br />
}

If you enable -Xcheck:jni you will get a crash right before line2. If you disable -Xcheck:jni you will get the exceptions I mentioned. I'm not sure if the two are related but I suspect they are. This issue is making it hell to debug my program. The JVM is throwing up too much "noise" for me to track down the bugs in my own native code. Please help!