-
Bug
-
Resolution: Fixed
-
P4
-
1.0.1, 1.2.0
-
b02
-
sparc
-
solaris_2.5.1, solaris_9
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2020587 | 1.2.0 | Mike Bronson | P4 | Resolved | Fixed | 1.2fcs |
JDK-2020586 | 1.1.7 | Mike Bronson | P4 | Resolved | Fixed | b01 |
The code pasted below worked under jdk1.1.5 but crashes with segmentation faults in jdk1.1.6. The JDialog ActionListeners have a call to dispose() which seems to be the problem. When I remove that call from the JDialog subclass and put it into main, I don't crash.
I am after information on the change from 1.1.5 to 1.1.6 that will explain this behavior and whether or not it will be fixed.
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import com.sun.java.swing.*;
class Dialog1 extends JDialog {
public Dialog1(JFrame dframe, Point center) {
super(frame, "A dialog", true);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add("Center", new JTextArea());
JButton button;
panel.add("South", button = new JButton("Dispose"));
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
panel.setPreferredSize(new Dimension(200,100));
getContentPane().add(panel);
pack();
setLocation(center);
show();
}
}
class Dialog2 extends JDialog {
public Dialog2(JFrame dframe, Point center) {
super(frame, "Another dialog", true);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add("North", new JTextField());
JButton button;
panel.add("South", button = new JButton("Dispose"));
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
panel.setPreferredSize(new Dimension(200,80));
getContentPane().add(panel);
pack();
setLocation(center);
show();
}
}
public class DialogTest extends JDialog {
public static void main(String args[]) {
final JFrame frame = new JFrame();
frame.setSize(200,100);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
final Point center = new Point(screenSize.width/2 - 50,
screenSize.height/2 - 50);
frame.setLocation(center);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
JPanel container = new JPanel();
container.setLayout(new GridLayout());
JButton buttons[] = new JButton[10];
int i = 0;
buttons[i] = new JButton("Press " + i);
container.add(buttons[i]);
buttons[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Dialog1(frame,center);
}
});
i++;
buttons[i] = new JButton("Press " + i);
container.add(buttons[i]);
buttons[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Dialog2(frame,center);
}
});
frame.getContentPane().add(container);
frame.show();
}
}
I am after information on the change from 1.1.5 to 1.1.6 that will explain this behavior and whether or not it will be fixed.
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import com.sun.java.swing.*;
class Dialog1 extends JDialog {
public Dialog1(JFrame dframe, Point center) {
super(frame, "A dialog", true);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add("Center", new JTextArea());
JButton button;
panel.add("South", button = new JButton("Dispose"));
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
panel.setPreferredSize(new Dimension(200,100));
getContentPane().add(panel);
pack();
setLocation(center);
show();
}
}
class Dialog2 extends JDialog {
public Dialog2(JFrame dframe, Point center) {
super(frame, "Another dialog", true);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add("North", new JTextField());
JButton button;
panel.add("South", button = new JButton("Dispose"));
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
panel.setPreferredSize(new Dimension(200,80));
getContentPane().add(panel);
pack();
setLocation(center);
show();
}
}
public class DialogTest extends JDialog {
public static void main(String args[]) {
final JFrame frame = new JFrame();
frame.setSize(200,100);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
final Point center = new Point(screenSize.width/2 - 50,
screenSize.height/2 - 50);
frame.setLocation(center);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
JPanel container = new JPanel();
container.setLayout(new GridLayout());
JButton buttons[] = new JButton[10];
int i = 0;
buttons[i] = new JButton("Press " + i);
container.add(buttons[i]);
buttons[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Dialog1(frame,center);
}
});
i++;
buttons[i] = new JButton("Press " + i);
container.add(buttons[i]);
buttons[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Dialog2(frame,center);
}
});
frame.getContentPane().add(container);
frame.show();
}
}
- backported by
-
JDK-2020586 JDialog subclass call to dispose crashes application with core dump
- Resolved
-
JDK-2020587 JDialog subclass call to dispose crashes application with core dump
- Resolved