[gtk+] printing: Don't hang in gtk_enumerate_printers()



commit 04c6811c3da3a761d51c3e14380f2d8e15d18ebd
Author: Marek Kasik <mkasik redhat com>
Date:   Wed Mar 26 12:29:46 2014 +0100

    printing: Don't hang in gtk_enumerate_printers()
    
    Stop enumerating printers when all backends were removed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686838

 gtk/gtkprinter.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkprinter.c b/gtk/gtkprinter.c
index c34eafb..5e145dd 100644
--- a/gtk/gtkprinter.c
+++ b/gtk/gtkprinter.c
@@ -1146,7 +1146,7 @@ backend_status_changed (GObject    *object,
     list_done_cb (backend, printer_list);  
 }
 
-static void
+static gboolean
 list_printers_remove_backend (PrinterList     *printer_list,
                               GtkPrintBackend *backend)
 {
@@ -1155,7 +1155,12 @@ list_printers_remove_backend (PrinterList     *printer_list,
   g_object_unref (backend);
 
   if (printer_list->backends == NULL)
-    free_printer_list (printer_list);
+    {
+      free_printer_list (printer_list);
+      return TRUE;
+    }
+
+  return FALSE;
 }
 
 static void
@@ -1193,7 +1198,10 @@ list_printers_init (PrinterList     *printer_list,
   
   if (status == GTK_PRINT_BACKEND_STATUS_UNAVAILABLE || 
       gtk_print_backend_printer_list_is_done (backend))
-    list_printers_remove_backend(printer_list, backend);
+    {
+      if (list_printers_remove_backend (printer_list, backend))
+        return TRUE;
+    }
   else
     {
       g_signal_connect (backend, "printer-added", 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]