diff --git a/app/base/base.c b/app/base/base.c index 34f2345a11..9d32454720 100644 --- a/app/base/base.c +++ b/app/base/base.c @@ -40,6 +40,7 @@ #include "base.h" #include "pixel-processor.h" #include "tile-cache.h" +#include "tile-manager.h" #include "tile-swap.h" @@ -116,6 +117,10 @@ base_exit (void) { g_return_if_fail (base_config != NULL); +#ifdef GIMP_UNSTABLE + tile_manager_exit (); +#endif + pixel_processor_exit (); paint_funcs_free (); tile_cache_exit (); diff --git a/app/base/tile-manager.c b/app/base/tile-manager.c index 1186781c39..556498ca3b 100644 --- a/app/base/tile-manager.c +++ b/app/base/tile-manager.c @@ -39,6 +39,11 @@ extern gint tile_exist_peak; extern gint tile_exist_count; #endif +#ifdef GIMP_UNSTABLE +GList *tile_managers = NULL; +#endif + + GType gimp_tile_manager_get_type (void) { @@ -52,6 +57,26 @@ gimp_tile_manager_get_type (void) return type; } +#ifdef GIMP_UNSTABLE +void +tile_manager_exit (void) +{ + if (tile_managers) + { + g_warning ("%d tile managers leaked", g_list_length (tile_managers)); + + while (tile_managers) + { + g_printerr ("unref tile manager %p (%d x %d)\n", + tile_managers->data, + tile_manager_width (tile_managers->data), + tile_manager_height (tile_managers->data)); + + tile_manager_unref (tile_managers->data); + } + } +} +#endif static inline gint tile_manager_get_tile_num (TileManager *tm, @@ -65,7 +90,6 @@ tile_manager_get_tile_num (TileManager *tm, return (ypixel / TILE_HEIGHT) * tm->ntile_cols + (xpixel / TILE_WIDTH); } - TileManager * tile_manager_new (gint width, gint height, @@ -86,6 +110,10 @@ tile_manager_new (gint width, tm->ntile_cols = (width + TILE_WIDTH - 1) / TILE_WIDTH; tm->cached_num = -1; +#ifdef GIMP_UNSTABLE + tile_managers = g_list_prepend (tile_managers, tm); +#endif + return tm; } @@ -108,6 +136,10 @@ tile_manager_unref (TileManager *tm) if (tm->ref_count < 1) { +#ifdef GIMP_UNSTABLE + tile_managers = g_list_remove (tile_managers, tm); +#endif + if (tm->cached_tile) tile_release (tm->cached_tile, FALSE); diff --git a/app/base/tile-manager.h b/app/base/tile-manager.h index 17d6d23973..40b5045244 100644 --- a/app/base/tile-manager.h +++ b/app/base/tile-manager.h @@ -24,6 +24,9 @@ GType gimp_tile_manager_get_type (void) G_GNUC_CONST; +#ifdef GIMP_UNSTABLE +void tile_manager_exit (void); +#endif /* Creates a new tile manager with the specified size */ TileManager * tile_manager_new (gint width,