From d183d67e88aaaad884f86128d2ab1a137297f7aa Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Tue, 22 Sep 2009 09:30:05 +0000 Subject: [PATCH] - Fixed race when fetching device list (bug #521110). --- system-config-printer-fetchdevices.patch | 51 ++++++++++++++++++++++++ system-config-printer.spec | 7 +++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 system-config-printer-fetchdevices.patch diff --git a/system-config-printer-fetchdevices.patch b/system-config-printer-fetchdevices.patch new file mode 100644 index 0000000..452b829 --- /dev/null +++ b/system-config-printer-fetchdevices.patch @@ -0,0 +1,51 @@ +diff -up system-config-printer-1.1.13/system-config-printer.py.fetchdevices system-config-printer-1.1.13/system-config-printer.py +--- system-config-printer-1.1.13/system-config-printer.py.fetchdevices 2009-09-22 10:08:54.062669053 +0100 ++++ system-config-printer-1.1.13/system-config-printer.py 2009-09-22 10:10:12.138669093 +0100 +@@ -3855,9 +3855,7 @@ class NewPrinterGUI(GtkGUI): + self.fillDeviceTab() + self.rbtnNPFoomatic.set_active (True) + self.on_rbtnNPFoomatic_toggled(self.rbtnNPFoomatic) +- # Start fetching information from CUPS in the background + self.new_printer_PPDs_loaded = False +- self.queryPPDs () + + elif self.dialog_mode == "class": + self.NewPrinterWindow.set_title(_("New Class")) +@@ -4648,16 +4646,18 @@ class NewPrinterGUI(GtkGUI): + debugprint ("fetchDevices") + + have_polkit_1 = self.mainapp.cups._use_pk and config.WITH_POLKIT_1 +- if not have_polkit_1: +- if network: +- return {} +- +- network = True +- + network_schemes = ["dnssd", "snmp"] + try: +- c = authconn.Connection (host=self.mainapp.connect_server, +- parent=parent, lock=True) ++ try: ++ c = self.fetchDevices_conn ++ except AttributeError: ++ c = authconn.Connection (host=self.mainapp.connect_server, ++ parent=parent, lock=True) ++ if not have_polkit_1: ++ # Use this connection for future calls so that the ++ # username/password is cached. ++ self.fetchDevices_conn = c ++ + debugprint ("in get_devices: connected") + c._begin_operation (_("fetching device list")) + try: +@@ -5049,6 +5049,10 @@ class NewPrinterGUI(GtkGUI): + kwargs={"network": True}, + callback=self.got_devices, + context=context) ++ else: ++ # Now we've fetched both local and network devices, start ++ # querying the available PPDs. ++ gobject.timeout_add (1, self.queryPPDs) + + devices = result + if current_uri: diff --git a/system-config-printer.spec b/system-config-printer.spec index a779a0d..efa65d2 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -7,7 +7,7 @@ Summary: A printer administration tool Name: system-config-printer Version: 1.1.13 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ URL: http://cyberelk.net/tim/software/system-config-printer/ Group: System Environment/Base @@ -19,6 +19,7 @@ Patch1: system-config-printer-data-button-state.patch Patch2: system-config-printer-cancel-traceback.patch Patch3: system-config-printer-publish-printers.patch Patch4: system-config-printer-iconify.patch +Patch5: system-config-printer-fetchdevices.patch BuildRequires: cups-devel >= 1.2 BuildRequires: python-devel >= 2.4 @@ -83,6 +84,7 @@ printers. %patch2 -p1 -b .cancel-traceback %patch3 -p1 -b .publish-printers %patch4 -p1 -b .iconify +%patch5 -p1 -b .fetchdevices %build %configure --with-udev-rules --with-polkit-1 @@ -194,6 +196,9 @@ rm -rf %buildroot exit 0 %changelog +* Tue Sep 22 2009 Tim Waugh 1.1.13-3 +- Fixed race when fetching device list (bug #521110). + * Fri Sep 18 2009 Tim Waugh 1.1.13-2 - Iconify jobs window into status icon. - Avoid showing the publish-printers dialog when not necessary.