]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The scheduler would crash if you started a printer that pointed to a backend
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sat, 21 Jun 2008 00:06:02 +0000 (00:06 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sat, 21 Jun 2008 00:06:02 +0000 (00:06 +0000)
that did not exist (STR #2865)

scheduler/ipp.c:
    - send_document(): Delay calling cupsdCheckJobs() until after we add
      the response info.

scheduler/job.c:
    - start_job(): Always reset filters pointer after calling cupsArrayDelete()
      if we don't return right away.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@7682 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.3.txt
scheduler/ipp.c
scheduler/job.c

index aa85f31d249c98b05dd027975a9764c6ee8f12f8..ba278571210dc54170d799f62d8723948e6a95b6 100644 (file)
@@ -4,6 +4,8 @@ CHANGES-1.3.txt
 CHANGES IN CUPS V1.3.8
 
        - Documentation updates (STR #2785, STR #2861, STR #2862)
+       - The scheduler would crash if you started a printer that
+         pointed to a backend that did not exist (STR #2865)
        - The ppdLocalize functions incorrectly mapped all generic
          locales to country-specific locales.
        - The cups-driverd program did not support Simplified Chinese
index c584290f52b7937a1351b5086829ca14265edb9e..e8c62748643ce56d98df99908e90945e7a8a68a5 100644 (file)
@@ -9432,6 +9432,7 @@ send_document(cupsd_client_t  *con,       /* I - Client connection */
   struct stat          fileinfo;       /* File information */
   int                  kbytes;         /* Size of file */
   int                  compression;    /* Type of compression */
+  int                  start_job;      /* Start the job? */
 
 
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "send_document(%p[%d], %s)", con,
@@ -9734,16 +9735,7 @@ send_document(cupsd_client_t  *con,      /* I - Client connection */
     job->dirty = 1;
     cupsdMarkDirty(CUPSD_DIRTY_JOBS);
 
-   /*
-    * Start the job if possible...  Since cupsdCheckJobs() can cancel a
-    * job if it doesn't print, we need to re-find the job afterwards...
-    */
-
-    jobid = job->id;
-
-    cupsdCheckJobs();
-
-    job = cupsdFindJob(jobid);
+    start_job = 1;
   }
   else
   {
@@ -9760,6 +9752,8 @@ send_document(cupsd_client_t  *con,       /* I - Client connection */
 
       cupsdMarkDirty(CUPSD_DIRTY_JOBS);
     }
+
+    start_job = 0;
   }
 
  /*
@@ -9775,10 +9769,17 @@ send_document(cupsd_client_t  *con,     /* I - Client connection */
   ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", jobid);
 
   ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state",
-                job ? job->state_value : IPP_JOB_CANCELED);
+                job->state_value);
   add_job_state_reasons(con, job);
 
   con->response->request.status.status_code = IPP_OK;
+
+ /*
+  * Start the job if necessary...
+  */
+
+  if (start_job)
+    cupsdCheckJobs();
 }
 
 
index 8fea1f71e9842bd8748107d7b6768940b23d3af0..e1091ed58308a035ac35b7758c8a7f567f9cabf3 100644 (file)
@@ -3390,6 +3390,7 @@ start_job(cupsd_job_t     *job,           /* I - Job ID */
   }
 
   cupsArrayDelete(filters);
+  filters = NULL;
 
  /*
   * Finally, pipe the final output into a backend process if needed...