Bug 417351: (Linux only) Initialize nsDeviceContextSpecGTK member data to null, fixing crash in destructor when cancelling printing. r+sr=roc, a=blocking1.9+

This commit is contained in:
dholbert@cs.stanford.edu 2008-02-13 15:14:52 -08:00
parent c545189a81
commit b05af4d0c6

View File

@ -386,6 +386,8 @@ nsStringArray* GlobalPrinters::mGlobalPrinterList = nsnull;
nsDeviceContextSpecGTK::nsDeviceContextSpecGTK()
{
DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::nsDeviceContextSpecGTK()\n"));
mGtkPageSetup = nsnull;
mGtkPrintSettings = nsnull;
}
nsDeviceContextSpecGTK::~nsDeviceContextSpecGTK()
@ -394,12 +396,10 @@ nsDeviceContextSpecGTK::~nsDeviceContextSpecGTK()
if (mGtkPageSetup) {
g_object_unref(mGtkPageSetup);
mGtkPageSetup = NULL;
}
if (mGtkPrintSettings) {
g_object_unref(mGtkPrintSettings);
mGtkPrintSettings = NULL;
}
}
@ -706,7 +706,7 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::BeginDocument(PRUnichar * aTitle, PRUnicha
NS_IMETHODIMP nsDeviceContextSpecGTK::EndDocument()
{
if (mToPrinter) {
if (!gtk_print_job_set_source_file(mPrintJob, mSpoolName.get(), NULL))
if (!gtk_print_job_set_source_file(mPrintJob, mSpoolName.get(), nsnull))
return NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE;
NS_ADDREF(mSpoolFile.get());