Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] SWT - X Window System error Crash on Solaris (Sparc) 10u8 GTK / SWT 3.6.2 / JRE 1.6u24

Can anyone please tell me why this is crashing?  I've spent all day trying to figure this out.
It runs fine on windows. 

This is the simplest example i could get to crash everytime.

I've testing on both JRE 1.6u23 and 1.6u24.
SWT 3.6.2 (Solaris SPARC GTK)
Solaris Sparc 10u8

Here is the error:

The program 'SWT' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 653 error_code 8 request_code 129 minor_code 4)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)


Here is the code that reproduces it every time, just click OK on the JOptionPane pop-up and it will crash.
What's really weird is if i delete these 3 lines:


            message += "Select OK to continue, ";
            message += "Cancel to terminate client application.\n";
            message += "\n";
          
it won't crash, so i'm guessing something is clobbering someone elses memory space.
Anyways here's the full source:

To compile:  javac -cp swt.jar CrashApp.java
To run: java -cp ./:swt.jar CrashApp

--------------------------START CODE---------------------------------------

import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

import org.eclipse.swt.widgets.Display;


public class CrashApp extends javax.swing.JFrame
{
    public boolean            reloadListFlag = false;
    private Object[]          useridData = null;

    public CrashApp()
    {
        System.out.println("-------------------------------------------");

       
        setResizable(false);
        setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(new GridBagLayout());
        setSize(405,305);
        setVisible(false);
        mainPanel.setBorder(emptyBorder1);
        mainPanel.setLayout(new GridBagLayout());

        getContentPane().add(mainPanel, new GridBagConstraints(-1,-1,1,1,1.0,1.0,GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));

        mainPanel.setBounds(22,25,361,255);
        mainLabel.setText("Please enter your User ID, Personal Name and Password");
        mainPanel.add(mainLabel, new GridBagConstraints(0,0,2,1,1.0,1.0,GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(0,0,10,0),0,0));
        mainLabel.setBounds(19,5,322,15);
        useridLabel.setText("User ID");
        mainPanel.add(useridLabel, new GridBagConstraints(0,1,1,1,1.0,1.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,5,5),0,0));
        useridLabel.setBounds(51,88,41,15);
        useridScrollPane.setOpaque(true);
        mainPanel.add(useridScrollPane, new GridBagConstraints(1,1,1,1,1.0,1.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(0,0,5,0),0,0));
        useridScrollPane.setBounds(97,30,259,131);
        useridList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        useridScrollPane.getViewport().add(useridList);
        useridList.setBounds(0,0,256,128);
        personalNameLabel.setText("Personal Name");
        mainPanel.add(personalNameLabel, new GridBagConstraints(0,2,1,1,1.0,1.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,5,5),0,0));
        personalNameLabel.setBounds(5,168,87,15);
        mainPanel.add(personalNameTextField, new GridBagConstraints(1,2,1,1,1.0,1.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(0,0,5,0),0,0));
        personalNameTextField.setBounds(97,166,4,19);
        passwordLabel.setText("Password");
        mainPanel.add(passwordLabel, new GridBagConstraints(0,3,1,1,1.0,1.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,10,5),0,0));
        passwordLabel.setBounds(34,190,58,15);
        mainPanel.add(passwordField, new GridBagConstraints(1,3,1,1,1.0,1.0,GridBagConstraints.WEST,GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
        passwordField.setBounds(97,193,4,19);
        buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER,5,5));
        mainPanel.add(buttonPanel, new GridBagConstraints(0,4,2,1,1.0,1.0,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,0,0),0,0));
        buttonPanel.setBounds(217,215,139,35);
        okButton.setText("OK");
        okButton.setActionCommand("OK");
        buttonPanel.add(okButton);
        okButton.setBounds(5,5,51,25);
        cancelButton.setText("Cancel");
        cancelButton.setActionCommand("Cancel");
        buttonPanel.add(cancelButton);
        cancelButton.setBounds(61,5,73,25);
        helpButton.setText("Help");
        helpButton.setActionCommand("Help");
        buttonPanel.add(helpButton);
        classificationField.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        classificationField.setEditable(false);
        classificationField.setBackground(new java.awt.Color(34,139,34));
        classificationField.setBounds(0,0,20,40);

        classSCIField.setEditable(false);

        JPanel classLine = new JPanel(new FlowLayout(FlowLayout.CENTER,0,0));
        mainPanel.add(classLine,
                        new GridBagConstraints(
                            0,5,2,1,1.0,1.0,
                            GridBagConstraints.CENTER,
                            GridBagConstraints.HORIZONTAL,
                            new Insets(0,0,0,0),0,0));

        classLine.add(classificationField);
        classLine.add(classSCIField);

        useridData = new Object[3];
       
        useridData[0] = "jay";
        useridData[1] = "jay2";
        useridData[2] = "jay3";

        useridList.setListData(useridData);

        if(true){
            String message = "Client and server versions may be incompatible.\n";
            message += "Select OK to continue, ";
            message += "Cancel to terminate client application.\n";
            message += "\n";
            int choice = JOptionPane.showConfirmDialog(this,
                message, "Startup Error", JOptionPane.OK_CANCEL_OPTION);
            if(choice == JOptionPane.CANCEL_OPTION) System.exit(0);
        }

        pack();

        System.out.println();
        System.out.println("---------------------------------------------");
      
    }

   
    static public void main(String args[])
    {
        SwingUtilities.invokeLater(new Runnable()
        {       
            @Override
            public void run()
            {
                try
                {    
                    new CrashApp().setVisible(true);
                }
                catch(Exception ex)
                {
                    ex.printStackTrace();
                }
            }
        });      
        Display display = new Display();
        System.out.println("Entering SWT Display loop");
        while (!display.isDisposed()) {
            if (!display.readAndDispatch()) display.sleep();
        }
        System.out.println("SWT Event Thread Killed");
    }   
 
    javax.swing.JPanel mainPanel = new javax.swing.JPanel();
    javax.swing.JLabel mainLabel = new javax.swing.JLabel();
    javax.swing.JLabel useridLabel = new javax.swing.JLabel();
    javax.swing.JScrollPane useridScrollPane = new javax.swing.JScrollPane();
    javax.swing.JList useridList = new javax.swing.JList();
    javax.swing.JLabel personalNameLabel = new javax.swing.JLabel();
    javax.swing.JTextField personalNameTextField = new javax.swing.JTextField();
    javax.swing.JLabel passwordLabel = new javax.swing.JLabel();
    javax.swing.JPasswordField passwordField = new javax.swing.JPasswordField();
    javax.swing.JPanel buttonPanel = new javax.swing.JPanel();
    javax.swing.JButton okButton = new javax.swing.JButton();
    javax.swing.JButton cancelButton = new javax.swing.JButton();
    javax.swing.JButton helpButton = new javax.swing.JButton();
    javax.swing.JTextField classificationField = new javax.swing.JTextField();
    javax.swing.JTextField classSCIField = new javax.swing.JTextField();
    javax.swing.border.EmptyBorder emptyBorder1 =
        new javax.swing.border.EmptyBorder(5,5,5,5);
 
}

--------------------------END CODE---------------------------------------







 		 	   		  

Back to the top