Initialize members. Return early in EndDocument() if mPrintJob is null - it means the print operation was aborted earlier. b=415327 r+sr=roc

This commit is contained in:
Mats Palmgren 2009-03-30 18:15:56 +02:00
parent 7e75351acb
commit dd72b252c2

View File

@ -385,10 +385,12 @@ nsTArray<nsString>* GlobalPrinters::mGlobalPrinterList = nsnull;
//---------------
nsDeviceContextSpecGTK::nsDeviceContextSpecGTK()
: mPrintJob(NULL)
, mGtkPrinter(NULL)
, mGtkPrintSettings(NULL)
, mGtkPageSetup(NULL)
{
DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::nsDeviceContextSpecGTK()\n"));
mGtkPageSetup = nsnull;
mGtkPrintSettings = nsnull;
}
nsDeviceContextSpecGTK::~nsDeviceContextSpecGTK()
@ -718,6 +720,9 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::BeginDocument(PRUnichar * aTitle, PRUnicha
NS_IMETHODIMP nsDeviceContextSpecGTK::EndDocument()
{
if (mToPrinter) {
if (!mPrintJob)
return NS_OK; // The operation was aborted.
if (!gtk_print_job_set_source_file(mPrintJob, mSpoolName.get(), nsnull))
return NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE;