Hi,

This is a patch that stop the printing dialog from crashing should the 
user has not setup a default printer.
The fix is simply to check that the default printer value is not NULL 
before making it so.
Since it is allowed in Solaris printing to have a list of printer but 
not to destinate one as default.
This fixes 6504981.


code diff:
--- gtkprintbackendpapi.c    Sun Dec 17 17:29:05 2006
+++ gtkprintbackendpapi.c.hacked    Sun Dec 17 17:29:24 2006
@@ -536,6 +536,9 @@
 
       if (!printer)
         {
+          /* skip null printer name just in case */
+          if (name == NULL)
+        continue;
           /* skip the alias _default and _all printers */
                 if (strcmp(name, "_default")==0 || strcmp(name, "_all")==0)
             continue;   
@@ -547,10 +550,11 @@
          the request_details method will be called  at start up
            */
 
-          if (strcmp (name, papi_backend->default_printer)==0)
-        {
-          gtk_printer_set_is_default (printer, TRUE);
-          }   
+          if (papi_backend->default_printer != NULL)
+            if (strcmp (name, papi_backend->default_printer)==0)
+          {
+            gtk_printer_set_is_default (printer, TRUE);
+            }   
 
               gtk_printer_set_icon_name (printer, "gtk-print");
           gtk_print_backend_add_printer (backend, printer);


-Ghee

Reply via email to