V
Vincent Cantin
Hello,
I was doing a drag & drop (DnD) with a simple JComponent, but it made my IDE
crash. Later, I discovered the option "-Xcheck:jni" in the command line of
the jvm and now I start to see why it crashed. Now when I start a DnD with
this option, the following message is displayed on the console and the JVM
stop.
FATAL ERROR in native method: Bad global or local ref passed to JNI
at sun.awt.windows.WToolkit.eventLoop(Native Method)
at sun.awt.windows.WToolkit.run(WToolkit.java:262)
at java.lang.Thread.run(Thread.java:534)
I reduiced to the minimum the code to isolate the problem and it seems to
crash on a really simple example.
Here is the reduiced program which make the JVM crash when using the
"-Xcheck:jni" option :
import java.awt.event.*;
import javax.swing.*;
public class BugComponent extends JLabel {
public BugComponent()
{
setText("Drag me and Bug");
setTransferHandler(new TransferHandler("text"));
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent event) {
JComponent component = (JComponent) event.getSource();
TransferHandler handler = component.getTransferHandler();
handler.exportAsDrag(component, event, TransferHandler.COPY);
}
});
}
public static void main(String[] args)
{
JFrame f = new JFrame();
f.getContentPane().add(new BugComponent());
f.setSize(100, 100);
f.show();
}
}
Someone know how to find a way to not make the JVM crash ??
Thank you,
Vincent Cantin
I was doing a drag & drop (DnD) with a simple JComponent, but it made my IDE
crash. Later, I discovered the option "-Xcheck:jni" in the command line of
the jvm and now I start to see why it crashed. Now when I start a DnD with
this option, the following message is displayed on the console and the JVM
stop.
FATAL ERROR in native method: Bad global or local ref passed to JNI
at sun.awt.windows.WToolkit.eventLoop(Native Method)
at sun.awt.windows.WToolkit.run(WToolkit.java:262)
at java.lang.Thread.run(Thread.java:534)
I reduiced to the minimum the code to isolate the problem and it seems to
crash on a really simple example.
Here is the reduiced program which make the JVM crash when using the
"-Xcheck:jni" option :
import java.awt.event.*;
import javax.swing.*;
public class BugComponent extends JLabel {
public BugComponent()
{
setText("Drag me and Bug");
setTransferHandler(new TransferHandler("text"));
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent event) {
JComponent component = (JComponent) event.getSource();
TransferHandler handler = component.getTransferHandler();
handler.exportAsDrag(component, event, TransferHandler.COPY);
}
});
}
public static void main(String[] args)
{
JFrame f = new JFrame();
f.getContentPane().add(new BugComponent());
f.setSize(100, 100);
f.show();
}
}
Someone know how to find a way to not make the JVM crash ??
Thank you,
Vincent Cantin