I've tested some of CUPS4Lazarus, but there are two bugs.
First: DoEnumPrinters is invoked two times during Refresh,
Second: on reset fPrinters should by unset fPrintersValid
This bug cause segFault, when DialogSelectPrinter is invoked second time
(cups doubled printers.count)
Darek
PS.Can somebody change CUPS4Lazarus:
procedure TCUPSPrinter.DoResetPrintersList;
begin
inherited DoResetPrintersList;
if Assigned(fcupsPrinter) then
begin
if Assigned(fcupsPPD) then
ppdClose(fcupsPPD);
fcupsPPD:=nil;
DeleteFile(fcupsPPDName);
fcupsPPDName:='';
end;
FreeOptions;
if Assigned(fcupsPrinters) then begin
cupsFreeDests(Printers.Count,fcupsPrinters);
fcupsPrinters:=nil; //
<- added
end;
end;
Index: lcl/printers.pas
===================================================================
--- lcl/printers.pas (wersja 8395)
+++ lcl/printers.pas (kopia robocza)
@@ -344,7 +344,6 @@
// it wont be filled on getting printers
// due to only one initialization
GetPrinters;
- DoEnumPrinters(fPrinters);
fPrinterIndex:=-1;
@@ -578,6 +577,7 @@
procedure TPrinter.DoResetPrintersList;
begin
//Override this methode
+ fPrintersValid:=false;
end;
procedure TPrinter.DoResetFontsList;