From 5ee1188ac54fae727929696f9501020860317951 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 28 Jun 2013 22:48:35 -0400 Subject: [PATCH] Bug 886518 - Purge the Skia typeface cache on shutdown in debug/valgrind builds r=jrmuizel --- gfx/skia/moz.build | 1 + gfx/thebes/gfxPlatform.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build index 66efd52407e1..4d292b09faa2 100644 --- a/gfx/skia/moz.build +++ b/gfx/skia/moz.build @@ -144,6 +144,7 @@ EXPORTS.skia += [ 'include/utils/SkDeferredCanvas.h', 'include/utils/SkRandom.h', 'include/views/SkTextBox.h', + 'src/core/SkTypefaceCache.h', ] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 906e02709886..518c2f9d847c 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -63,6 +63,10 @@ #include "TexturePoolOGL.h" #endif +#ifdef USE_SKIA +#include "skia/SkGraphics.h" +#endif + #ifdef USE_SKIA_GPU #include "skia/GrContext.h" #include "skia/GrGLInterface.h" @@ -472,9 +476,17 @@ gfxPlatform::~gfxPlatform() // cairo_debug_* function unconditionally. // // because cairo can assert and thus crash on shutdown, don't do this in release builds -#if MOZ_TREE_CAIRO && (defined(DEBUG) || defined(NS_BUILD_REFCNT_LOGGING) || defined(NS_TRACE_MALLOC)) +#if defined(DEBUG) || defined(NS_BUILD_REFCNT_LOGGING) || defined(NS_TRACE_MALLOC) || defined(MOZ_VALGRIND) +#ifdef USE_SKIA + // must do Skia cleanup before Cairo cleanup, because Skia may be referencing + // Cairo objects e.g. through SkCairoFTTypeface + SkGraphics::Term(); +#endif + +#if MOZ_TREE_CAIRO cairo_debug_reset_static_data(); #endif +#endif #if 0 // It would be nice to do this (although it might need to be after