Apache OpenOffice (AOO) Bugzilla – Issue 18047
XPrintJobListener crashes OOo when called
Last modified: 2013-02-24 21:10:13 UTC
I've created the simplist XPrintJobListener I could. I run my program, which opens a new doc, does a search and replace, then prints it, then exits. It doesn't save the doc or close it or anything. From printing, it goes straight to the quit code. Every time I run it, it crashes OOo. I've included code from the method that creates the listener as well as the listener itself, which is in its own class. This is the first time I've tried something like this and I wouldn't report it until I could check out more, except for 2 reasons: 1) It causes an actual crash, not just an error and 2) I don't know the timing before 1.1 goes gold, so I want to make sure the issue is reported in case it needs to be fixed. If I've jumped the gun and reported this too early, I apologize. Here's the print method that prints out the document and creates the listener: public void printDoc (XDocument oDoc) { XPrintable oPrint = (XPrintable) UnoRuntime.queryInterface(XPrintable.class, oDoc); PropertyValue[] printOpts = new PropertyValue[1]; printOpts[0] = new PropertyValue(); printOpts[0].Name = "Name"; printOpts[0].Value = sPrinter; //sPrinter already defined within class XPrintJobBroadcaster xPrintStat = (XPrintJobBroadcaster) UnoRuntime.queryInterface( XPrintJobBroadcaster.class,oPrint); PrintListener oListener = new PrintListener(); xPrintStat.addPrintJobListener(oListener); try {oPrint.print(printOpts);} catch (Exception e) {System.out.println("Printing exception: " + e);} return; } //---------------------- //And here's the listener class and method: //------------------- import com.sun.star.lang.*; import com.sun.star.uno.*; import com.sun.star.view.*; public class PrintListener implements XPrintJobListener { public void disposing(EventObject event) { } public void printJobEvent(PrintJobEvent event) { PrintableState oState = event.State; System.out.println("The printer state is changed: " + oState); return; } }
assigning target
Sorry, I cannot reproduce this with a close to OOo 1.1.1 version. I need more information.
returning to reporter
clearing resolution.
closing.