[Bug java/26152] New: gtkImage.c complains and crashes the application

cardona at ucla dot edu gcc-bugzilla@gcc.gnu.org
Tue Feb 7 11:10:00 GMT 2006


ImageJ, the public domain scientific-grade image processing application
compiles fine with the gcj-wrapper-4.0 in Kubuntu GNU/Linux-ppc when stripped
of JPEG functionality and its dependance on the tools.jar. But when trying to
open an image, the gtkImage.c file complains:

** ERROR **: file
../../../src/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c: line 572
(createRawData): assertion failed: (data_fid != 0)
aborting...


I attach a self-contained test case below. Here are the commands to compile and
run it:

$ /usr/bin/gcj-wrapper-4.0 -g testGtkImage.java
$ /usr/lib/jvm/java-gcj/bin/java testGtkImage


The JFileChooser never shows. Here's the error message:


** ERROR **: file
../../../src/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c: line 572
(createRawData): assertion failed: (data_fid != 0)
aborting...
Aborted



/************* START TEST CASE ************/
import java.awt.Canvas;
import java.awt.FileDialog;
import java.awt.Frame;
import java.io.File;
import javax.swing.SwingUtilities;
import javax.swing.JFileChooser;

public class testGtkImage {


        String omDirectory;
        File[] omFiles;

        testGtkImage() {
                final Frame frame = new Frame("testGtkImage");
                Canvas canvas = new Canvas();
                canvas.setSize(400, 200);
                frame.add(canvas);
                frame.setSize(400, 200);
                frame.pack();
                frame.show();

                // test FileDialog
                FileDialog fd = new FileDialog(frame, "Select file",
FileDialog.LOAD);
                fd.show();
                System.out.println(fd.getDirectory() + " " + fd.getFile());
                // NO PROBLEM with FileDialog

                // test JFileChooser as in ij.io.Opener.openMultiple()
                try {                   
                        SwingUtilities.invokeAndWait(new Runnable() {
                                public void run() {
                                        JFileChooser fc = new JFileChooser();
                                        fc.setMultiSelectionEnabled(true);
                                        File dir = null;
                                        String sdir = "/home/"; //
OpenDialog.getDefaultDirectory();
                                        if (sdir!=null)
                                                dir = new File(sdir);
                                        if (dir!=null)
                                                fc.setCurrentDirectory(dir);
                                        int returnVal =
fc.showOpenDialog(frame);
                                        if
(returnVal!=JFileChooser.APPROVE_OPTION)
                                                return;
                                        omFiles = fc.getSelectedFiles();
                                        if (omFiles.length==0) { //
getSelectedFiles does not work on some JVMs
                                                omFiles = new File[1];
                                                omFiles[0] =
fc.getSelectedFile();
                                        }
                                        omDirectory =
fc.getCurrentDirectory().getPath()+File.separator;
                                }
                        });
                } catch (Exception e) {} 
                if (omDirectory==null) return;
                //OpenDialog.setDefaultDirectory(omDirectory);
                for (int i=0; i<omFiles.length; i++) {
                        String path = omDirectory + omFiles[i].getName();
                        System.out.println("Path: " + path);
                        //open(path);
                        /*
                        if (i==0 && Recorder.record)
                                Recorder.recordPath("open", path);
                        if (i==0 && !error)
                                Menus.addOpenRecentItem(path);
                        */
                }
        }

        static public void main(String[] args) {
                new testGtkImage();
        }
}


/*********** EOF ********/


-- 
           Summary: gtkImage.c complains and crashes the application
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cardona at ucla dot edu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26152



More information about the Gcc-bugs mailing list