Closed tangyanli closed 1 year ago
Describe the bug The printer(s) cannot be loaded from the state file again after restart pappl
To Reproduce Steps to reproduce the behavior:
Expected behavior The pappl can load the printers from the state file again.
System Information:
Additional context In the papplSystemSaveState() file, 6 options are saved for a printer.
num_options = cupsAddIntegerOption("id", printer->printer_id, num_options, &options); num_options = cupsAddOption("name", printer->name, num_options, &options); num_options = cupsAddOption("did", printer->device_id ? printer->device_id : "", num_options, &options); num_options = cupsAddOption("uri", printer->device_uri, num_options, &options); num_options = cupsAddOption("driver", printer->driver_name, num_options, &options); if (system->options & PAPPL_SOPTIONS_MULTI_QUEUE) num_options = cupsAddIntegerOption("state", (int)printer->state, num_options, &options);
But in the papplSystemLoadState(), the printer is skipped when it's option number is not equal to 5.
if ((num_options = cupsParseOptions(value, 0, &options)) != 5 || (printer_id = cupsGetOption("id", num_options, options)) == NULL || strtol(printer_id, NULL, 10) <= 0 || (printer_name = cupsGetOption("name", num_options, options)) == NULL || (device_id = cupsGetOption("did", num_options, options)) == NULL || (device_uri = cupsGetOption("uri", num_options, options)) == NULL || (driver_name = cupsGetOption("driver", num_options, options)) == NULL) { papplLog(system, PAPPL_LOGLEVEL_ERROR, "Bad printer definition on line %d of '%s'.", linenum, filename); break; }
[master dc8e97b] Fix loading of previous state (Issue #298)
[v1.4.x 3a3c1e9] Fix loading of previous state (Issue #298)
Describe the bug The printer(s) cannot be loaded from the state file again after restart pappl
To Reproduce Steps to reproduce the behavior:
Expected behavior The pappl can load the printers from the state file again.
System Information:
Additional context In the papplSystemSaveState() file, 6 options are saved for a printer.
But in the papplSystemLoadState(), the printer is skipped when it's option number is not equal to 5.