Bug 413050 - call cairo_debug_reset_static_data in system cairo on shutdown r=pavlov
authorkarlt+@karlt.net
Mon, 11 Feb 2008 22:47:40 -0800
changeset 11579 a7c6fb1d21ea03cda67a7ed9ad8649fd12e254d9
parent 11578 fef10d33ab8337845f7fb5718161ca092086806f
child 11580 00faf8121179ace8e8033fd9fc5659acb33a49ff
push idunknown
push userunknown
push dateunknown
reviewerspavlov
bugs413050
milestone1.9b4pre
Bug 413050 - call cairo_debug_reset_static_data in system cairo on shutdown r=pavlov
configure.in
gfx/thebes/src/gfxPlatform.cpp
toolkit/xre/nsAppRunner.cpp
--- a/configure.in
+++ b/configure.in
@@ -6982,16 +6982,18 @@ MOZ_ARG_ENABLE_BOOL(system-cairo,
 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
 MOZ_TREE_CAIRO=,
 MOZ_TREE_CAIRO=1 )
 
 # Check for headers defining standard int types.
 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
 
 if test "$MOZ_TREE_CAIRO"; then
+    AC_DEFINE(MOZ_TREE_CAIRO)
+
     # For now we assume that we will have a uint64_t available through
     # one of the above headers or mozstdint.h.
     AC_DEFINE(HAVE_UINT64_T)
 
     # Define macros for cairo-features.h
     if test "$MOZ_X11"; then
         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
--- a/gfx/thebes/src/gfxPlatform.cpp
+++ b/gfx/thebes/src/gfxPlatform.cpp
@@ -186,17 +186,17 @@ gfxPlatform::Shutdown()
 gfxPlatform::~gfxPlatform()
 {
     // The cairo folks think we should only clean up in debug builds,
     // but we're generally in the habit of trying to shut down as
     // cleanly as possible even in production code, so call this
     // cairo_debug_* function unconditionally.
     //
     // because cairo can assert and thus crash on shutdown, don't do this in release builds
-#if defined(DEBUG) || defined(NS_BUILD_REFCNT_LOGGING) || defined(NS_TRACE_MALLOC)
+#if MOZ_TREE_CAIRO && (defined(DEBUG) || defined(NS_BUILD_REFCNT_LOGGING) || defined(NS_TRACE_MALLOC))
     cairo_debug_reset_static_data();
 #endif
 
 #if 0
     // It would be nice to do this (although it might need to be after
     // the cairo shutdown that happens in ~gfxPlatform).  It even looks
     // idempotent.  But it has fatal assertions that fire if stuff is
     // leaked, and we hit them.
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2361,16 +2361,20 @@ static void MOZ_gdk_display_close(GdkDis
     //
     // Let the gdk structures leak but at least close the Display,
     // assuming that gdk will not use it again.
     Display* dpy = GDK_DISPLAY_XDISPLAY(display);
     XCloseDisplay(dpy);
   }
   else {
     gdk_display_close(display);
+#if GTK_CHECK_VERSION(2,8,0) && \
+  (defined(DEBUG) || defined(NS_BUILD_REFCNT_LOGGING) || defined(NS_TRACE_MALLOC))
+    cairo_debug_reset_static_data();
+#endif
   }
 }
 #endif // MOZ_WIDGET_GTK2
 
 /** 
  * NSPR will search for the "nspr_use_zone_allocator" symbol throughout
  * the process and use it to determine whether the application defines its own
  * memory allocator or not.