Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6574633

native printDialog crashes when changing printer

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0u2
    • Fix Version/s: 5.0u19
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
      2d
    • Resolved In Build:
      b01
    • CPU:
      x86
    • OS:
      windows_vista

      Backports

        Description

        This is related to 6358747.
        Occurs in 1.5 update but not in 1.6.

        To reproduce:
        Run the following test and when the printDialog is shown, change the printer.

        import java.awt.Graphics;
        import java.awt.print.*;
        import javax.swing.*;
        import javax.swing.SwingUtilities;

        public class CrashJVM
        { static public void main(String[] args)
          { new AFrame().setVisible(true);
          }
          private static class AFrame extends JFrame
          { public AFrame()
             { final APanel aPanel = new APanel();
                SwingUtilities.invokeLater(new Runnable()
                     { public void run()
                         { aPanel.startPrint();
                         }
                     });
             }
          }
          private static class APanel extends JPanel
          { private APrintable report;
             public APanel()
             { report = new APrintable();
             }
             public Book getBook(PageFormat format)
             { return report.getBook(format);
             }
             public void startPrint()
             { PrinterJob job = PrinterJob.getPrinterJob();
                Paper a4Paper = new Paper();
                a4Paper.setSize(595, 840);
                a4Paper.setImageableArea(40, 40, 515, 760);
                PageFormat pageFormat = job.defaultPage();
                pageFormat.setOrientation(PageFormat.PORTRAIT);
                pageFormat.setPaper(a4Paper);
        for (int i=0; i<4; ++i) {
                //pageFormat = job.pageDialog(pageFormat);
                //job.setPageable(getBook(pageFormat));
        job.printDialog(); // <-- crashes the JVM
        }
             }
             private class APrintable extends JPanel implements Printable
             { public Book getBook(PageFormat format)
                { return new PrintBook(format);
                }
                public int print(Graphics g, PageFormat format, int page)
                { return PAGE_EXISTS;
                }
                private class PrintBook extends Book
                { public PrintBook(PageFormat format)
                   { append(APrintable.this, format, 1);
                   }
                }
             }
          }
        }

        RESULT:
        Crash on msctf.ime

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jgodinez Jennifer Godinez (Inactive)
                  Reporter:
                  jgodinez Jennifer Godinez (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: