[Bug 30721] Re: gnu_java_awt_peer_gtk_GtkImage.c fails with a simple test case

Bug Watch Updater 30721 at bugs.launchpad.net
Sat Mar 23 21:27:37 UTC 2013


** Changed in: gcc
   Importance: Unknown => Critical

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/30721

Title:
  gnu_java_awt_peer_gtk_GtkImage.c fails with a simple test case

Status in The GNU Compiler Collection:
  Invalid
Status in “gcc-defaults” package in Ubuntu:
  Fix Released

Bug description:
  I have filed this bug as http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26152
  in the GCJ bug tracker.
  Maybe in newer gcj versions this problem is solved. Is there any possibility to get newer packages, such as 4.0.2 instead of 4.0 ? I have little clue on how to go about compiling them myself, since the GCC site is such a mess and provides only the information I don't need for the purpose, or I have failed to find it.

  A copy of the bug report:

  
  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 ********/

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/30721/+subscriptions




More information about the foundations-bugs mailing list