summaryrefslogtreecommitdiff
path: root/test/text-cache-crash.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2004-11-23 12:53:46 +0000
committerCarl Worth <cworth@cworth.org>2004-11-23 12:53:46 +0000
commit7478ea5051306cf38ed29d9c9faa4c0263f413b8 (patch)
tree3f090401ae2ed72ef59a282f8145de8053f963dd /test/text-cache-crash.c
parent78f1206bf8d71d56117fa5dee95b1314f7b1421c (diff)
downloadcairo-7478ea5051306cf38ed29d9c9faa4c0263f413b8.tar.gz
Add note that bug has been fixed. (main): Instrumentation code for testing cache destruction.
Support tests that produce no output, (don't check image if (width,height) == (0,0)). Add #include <assert.h> here rather than in multiple .c files. Add const qualifier to static cache_arrangements table. (_cache_sane_state): Remove refcount assertion as it it false during the cairo_cache_destroy. (_cache_sane_state): #include <assert.h> moved up to cairoint.h (_entry_destroy): Fix bug in assertion (used_memory >= entry->memory), not >. (_cairo_cache_destroy): Fix timing of refcount decrement so that the destroy function actually works.
Diffstat (limited to 'test/text-cache-crash.c')
-rw-r--r--test/text-cache-crash.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/test/text-cache-crash.c b/test/text-cache-crash.c
index 56502345e..0a50b9324 100644
--- a/test/text-cache-crash.c
+++ b/test/text-cache-crash.c
@@ -51,17 +51,21 @@
* text_cache_crash: cairo_cache.c:422: _cairo_cache_lookup: Assertion `cache->max_memory >= (cache->used_memory + new_entry->memory)' failed.
*
* I'll have to go back and try the original test after I fix this.
+ *
+ * 2004-11-13 Carl Worth <cworth@cworth.org>
+ *
+ * Found the bug. cairo_gstate_select_font was noticing when the
+ * same font was selected twice in a row and was erroneously failing
+ * to free the old reference. Committed a fix and verified it also
+ * fixed the orginal test case.
*/
#include "cairo_test.h"
-#define WIDTH 100
-#define HEIGHT 60
-
cairo_test_t test = {
"text_cache_crash",
"Test case for bug causing an assertion failure in _cairo_cache_lookup",
- WIDTH, HEIGHT
+ 0, 0,
};
#include <cairo.h>
@@ -80,6 +84,24 @@ draw (cairo_t *cr, int width, int height)
int
main (void)
{
- return cairo_test (&test, draw);
+ int ret;
+
+ ret = cairo_test (&test, draw);
+
+ /* It's convenient to be able to free all memory (including
+ * statically allocated memory). This makes it quite easy to use
+ * tools such as valgrind to verify that there are no memory leaks
+ * whatsoever.
+ *
+ * But I'm not sure what would be a sensible cairo API function
+ * for this. The cairo_destroy_caches call below is just something
+ * I made as a local modification to cairo.
+ */
+ /*
+ cairo_destroy_caches ();
+ FcFini ();
+ */
+
+ return ret;
}