8039412: Stack overflow on Linux using DialogTypeSelection.NATIVE

Reviewed-by: prr, rchamyal
This commit is contained in:
Prasanta Sadhukhan 2015-11-17 19:15:48 +03:00
parent 1e176777db
commit 73b1044258
2 changed files with 66 additions and 1 deletions

View file

@ -740,7 +740,19 @@ public abstract class RasterPrinterJob extends PrinterJob {
}
updatePageAttributes(service, page);
PageFormat newPage = pageDialog(attributes);
PageFormat newPage = null;
DialogTypeSelection dts =
(DialogTypeSelection)attributes.get(DialogTypeSelection.class);
if (dts == DialogTypeSelection.NATIVE) {
// Remove DialogTypeSelection.NATIVE to prevent infinite loop in
// RasterPrinterJob.
attributes.remove(DialogTypeSelection.class);
newPage = pageDialog(attributes);
// restore attribute
attributes.add(DialogTypeSelection.NATIVE);
} else {
newPage = pageDialog(attributes);
}
if (newPage == null) {
return page;