[gtk+] Fix gtkprintbackendcups crash



commit 54ffc982e96bc4b2484a2611c7dc5cf24c4c4a1a
Author: John Ralls <jralls ceridwen us>
Date:   Fri Mar 1 10:13:20 2013 -0800

    Fix gtkprintbackendcups crash
    
    From trying to call g_list_delete_link with a NULL node or
    removed_printer_checklist.

 modules/printbackends/cups/gtkprintbackendcups.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c 
b/modules/printbackends/cups/gtkprintbackendcups.c
index 96f4be4..8dbc78b 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -2067,11 +2067,15 @@ cups_request_printer_list_cb (GtkPrintBackendCups *cups_backend,
         }
 
       /* remove name from checklist if it was found */
-      node = g_list_find_custom (removed_printer_checklist,
-                                info->printer_name,
-                                (GCompareFunc) find_printer);
-      removed_printer_checklist = g_list_delete_link (removed_printer_checklist,
-                                                     node);
+      if (removed_printer_checklist != NULL)
+      {
+          if (node = g_list_find_custom (removed_printer_checklist,
+                                         info->printer_name,
+                                         (GCompareFunc) find_printer))
+               removed_printer_checklist =
+                    g_list_delete_link (removed_printer_checklist,
+                                        node);
+      }
 
       printer = gtk_print_backend_find_printer (backend, info->printer_name);
       if (!printer)


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