Bug 739604 - Check if output file is valid before printing. r=mattwoodrow
authorChris Lord <chrislord.net@gmail.com>
Wed, 28 Mar 2012 19:10:22 +0100
changeset 90522 f4ab0eddbe90b4c588b29ea1f1b39d6b14a47e09
parent 90521 35546f02ddb10a4094345a7c624fbc401333defa
child 90523 2fbd3599386cccd457c5b9cee0a578e50000400d
push id7704
push userchrislord.net@gmail.com
push dateWed, 28 Mar 2012 18:10:58 +0000
treeherdermozilla-inbound@2fbd3599386c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs739604
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 739604 - Check if output file is valid before printing. r=mattwoodrow Check that gfxUtils::sDumpPaintFile isn't NULL before calling print functions in Layers.cpp:WriteSnapshotToDumpFile_internal().
gfx/layers/Layers.cpp
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -567,19 +567,21 @@ void WriteSnapshotLinkToDumpFile(T* aObj
 }
 
 template <typename T>
 void WriteSnapshotToDumpFile_internal(T* aObj, gfxASurface* aSurf)
 {
   nsCString string(aObj->Name());
   string.Append("-");
   string.AppendInt((PRUint64)aObj);
-  fprintf(gfxUtils::sDumpPaintFile, "array[\"%s\"]=\"", string.BeginReading());
+  if (gfxUtils::sDumpPaintFile)
+    fprintf(gfxUtils::sDumpPaintFile, "array[\"%s\"]=\"", string.BeginReading());
   aSurf->DumpAsDataURL(gfxUtils::sDumpPaintFile);
-  fprintf(gfxUtils::sDumpPaintFile, "\";");
+  if (gfxUtils::sDumpPaintFile)
+    fprintf(gfxUtils::sDumpPaintFile, "\";");
 }
 
 void WriteSnapshotToDumpFile(Layer* aLayer, gfxASurface* aSurf)
 {
   WriteSnapshotToDumpFile_internal(aLayer, aSurf);
 }
 
 void WriteSnapshotToDumpFile(LayerManager* aManager, gfxASurface* aSurf)