Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 665218 - Keep the printing surface until the next BeginPage to av…

…oid null-ptr crash [MacOSX only]. r=roc
  • Loading branch information...
commit 064f27c8876a6da9a1e86353b220ddbe9a005135 1 parent 4b29760
@MatsPalmgren MatsPalmgren authored
Showing with 5 additions and 8 deletions.
  1. +5 −8 gfx/src/nsDeviceContext.cpp
View
13 gfx/src/nsDeviceContext.cpp
@@ -634,10 +634,14 @@ nsDeviceContext::BeginPage(void)
if (NS_FAILED(rv)) return rv;
- /* We need to get a new surface for each page on the Mac */
#ifdef XP_MACOSX
+ // We need to get a new surface for each page on the Mac, as the
+ // CGContextRefs are only good for one page.
+ // And we don't null it out in EndPage because mPrintingSurface needs
+ // to be available also in-between EndPage/BeginPage (bug 665218).
mDeviceContextSpec->GetSurfaceForPrinter(getter_AddRefs(mPrintingSurface));
#endif
+
rv = mPrintingSurface->BeginPage();
return rv;
@@ -648,13 +652,6 @@ nsDeviceContext::EndPage(void)
{
nsresult rv = mPrintingSurface->EndPage();
- /* We need to release the CGContextRef in the surface here, plus it's
- not something you would want anyway, as these CGContextRefs are only good
- for one page. */
-#ifdef XP_MACOSX
- mPrintingSurface = nsnull;
-#endif
-
if (mDeviceContextSpec)
mDeviceContextSpec->EndPage();
Please sign in to comment.
Something went wrong with that request. Please try again.