mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8263984: Invalidate printServices when there are no printers
Reviewed-by: serb, jdv
This commit is contained in:
parent
adb860ec10
commit
9d6503978d
1 changed files with 7 additions and 1 deletions
|
@ -116,6 +116,7 @@ public class PrintServiceLookupProvider extends PrintServiceLookup {
|
|||
if (printers == null) {
|
||||
// In Windows it is safe to assume no default if printers == null so we
|
||||
// don't get the default.
|
||||
invalidateServices();
|
||||
printServices = new PrintService[0];
|
||||
return;
|
||||
}
|
||||
|
@ -146,16 +147,21 @@ public class PrintServiceLookupProvider extends PrintServiceLookup {
|
|||
}
|
||||
}
|
||||
|
||||
invalidateServices();
|
||||
printServices = newServices;
|
||||
}
|
||||
|
||||
private void invalidateServices() {
|
||||
// Look for deleted services and invalidate these
|
||||
if (printServices != null) {
|
||||
for (int j=0; j < printServices.length; j++) {
|
||||
if ((printServices[j] instanceof Win32PrintService) &&
|
||||
(!printServices[j].equals(defaultPrintService))) {
|
||||
|
||||
((Win32PrintService)printServices[j]).invalidateService();
|
||||
}
|
||||
}
|
||||
}
|
||||
printServices = newServices;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue