From c1d6bbe43372ae7ea0a4e122180fde141c8be6ec Mon Sep 17 00:00:00 2001 From: "waqar%netscape.com" Date: Mon, 30 Oct 2000 15:22:46 +0000 Subject: [PATCH] #=34706 r=dcone@netscape.com a=buster@netscape.com d=Fixes a crash on linux when printing to a file in a directory where I dont have permission to or printing to a directory or to a non existing printer. git-svn-id: svn://10.0.0.236/trunk@82003 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsDocumentViewer.cpp | 2 +- mozilla/gfx/src/ps/nsDeviceContextPS.cpp | 6 +++--- mozilla/gfx/src/ps/nsPostScriptObj.cpp | 3 ++- mozilla/layout/base/nsDocumentViewer.cpp | 2 +- mozilla/layout/base/src/nsDocumentViewer.cpp | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/mozilla/content/base/src/nsDocumentViewer.cpp b/mozilla/content/base/src/nsDocumentViewer.cpp index 59a576257a6..2deb0d3d196 100644 --- a/mozilla/content/base/src/nsDocumentViewer.cpp +++ b/mozilla/content/base/src/nsDocumentViewer.cpp @@ -952,7 +952,7 @@ DocumentViewerImpl::PrintContent(nsIWebShell * aParent, // now complete printing the rest of the document // if it doesn't contain any framesets if (!doesContainFrameSet) { - aDContext->BeginDocument(); + NS_ENSURE_SUCCESS( aDContext->BeginDocument(), NS_ERROR_FAILURE ); aDContext->GetDeviceSurfaceDimensions(width, height); nsCOMPtr cx; diff --git a/mozilla/gfx/src/ps/nsDeviceContextPS.cpp b/mozilla/gfx/src/ps/nsDeviceContextPS.cpp index e641cadf4f1..078cfedbe3c 100644 --- a/mozilla/gfx/src/ps/nsDeviceContextPS.cpp +++ b/mozilla/gfx/src/ps/nsDeviceContextPS.cpp @@ -307,16 +307,16 @@ NS_IMETHODIMP nsDeviceContextPS::GetDeviceContextFor(nsIDeviceContextSpec *aDevi NS_IMETHODIMP nsDeviceContextPS::BeginDocument(void) { nsIDeviceContextSpecPS *psSpec; - nsresult res; + nsresult res = NS_OK; if ( nsnull != mSpec ) { mPSObj = new nsPostScriptObj(); res = mSpec->QueryInterface(kIDeviceContextSpecPSIID, (void **) &psSpec); if ( res == NS_OK ) { - mPSObj->Init(psSpec); + res = mPSObj->Init(psSpec); } } - return NS_OK; + return res; } /** --------------------------------------------------- diff --git a/mozilla/gfx/src/ps/nsPostScriptObj.cpp b/mozilla/gfx/src/ps/nsPostScriptObj.cpp index 899e4fd87f8..b059cbb2f0f 100644 --- a/mozilla/gfx/src/ps/nsPostScriptObj.cpp +++ b/mozilla/gfx/src/ps/nsPostScriptObj.cpp @@ -223,6 +223,7 @@ printf( "top %f bottom %f left %f right %f\n", top, bottom, left, right ); #ifndef VMS aSpec->GetCommand( &buf ); #ifdef XP_OS2_VACPP + mPrintSetup->out = NULL; // popen not defined OS2TODO #else mPrintSetup->out = popen( buf, "w" ); @@ -245,7 +246,7 @@ printf( "top %f bottom %f left %f right %f\n", top, bottom, left, right ); /* make sure the open worked */ - if ( mPrintSetup->out < 0 ) + if ( mPrintSetup->out == NULL ) return NS_ERROR_FAILURE; mPrintContext = new PSContext(); memset(mPrintContext, 0, sizeof(struct PSContext_)); diff --git a/mozilla/layout/base/nsDocumentViewer.cpp b/mozilla/layout/base/nsDocumentViewer.cpp index 59a576257a6..2deb0d3d196 100644 --- a/mozilla/layout/base/nsDocumentViewer.cpp +++ b/mozilla/layout/base/nsDocumentViewer.cpp @@ -952,7 +952,7 @@ DocumentViewerImpl::PrintContent(nsIWebShell * aParent, // now complete printing the rest of the document // if it doesn't contain any framesets if (!doesContainFrameSet) { - aDContext->BeginDocument(); + NS_ENSURE_SUCCESS( aDContext->BeginDocument(), NS_ERROR_FAILURE ); aDContext->GetDeviceSurfaceDimensions(width, height); nsCOMPtr cx; diff --git a/mozilla/layout/base/src/nsDocumentViewer.cpp b/mozilla/layout/base/src/nsDocumentViewer.cpp index 59a576257a6..2deb0d3d196 100644 --- a/mozilla/layout/base/src/nsDocumentViewer.cpp +++ b/mozilla/layout/base/src/nsDocumentViewer.cpp @@ -952,7 +952,7 @@ DocumentViewerImpl::PrintContent(nsIWebShell * aParent, // now complete printing the rest of the document // if it doesn't contain any framesets if (!doesContainFrameSet) { - aDContext->BeginDocument(); + NS_ENSURE_SUCCESS( aDContext->BeginDocument(), NS_ERROR_FAILURE ); aDContext->GetDeviceSurfaceDimensions(width, height); nsCOMPtr cx;