From 3c870a7a6cb44976317b2723e7a1f02c2c9409fe Mon Sep 17 00:00:00 2001 From: David Schleef Date: Fri, 25 Sep 2009 18:14:28 -0700 Subject: [PATCH] cog: reset cache instead of returning NULL Returning NULL makes things crash. Resetting the cache makes things run slow. Still an underlying bug somewhere, but not critical. --- ext/cog/cogvirtframe.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ext/cog/cogvirtframe.c b/ext/cog/cogvirtframe.c index eb6fc00520..36743039c9 100644 --- a/ext/cog/cogvirtframe.c +++ b/ext/cog/cogvirtframe.c @@ -139,8 +139,14 @@ cog_virt_frame_get_line (CogFrame * frame, int component, int i) } if (i < frame->cache_offset[component]) { - g_warning ("cache failure"); - return NULL; + g_warning ("cache failure: %d outside [%d,%d]", i, + frame->cache_offset[component], + frame->cache_offset[component] + COG_FRAME_CACHE_SIZE - 1); + + frame->cache_offset[component] = i; + for (j = 0; j < COG_FRAME_CACHE_SIZE; j++) { + frame->cached_lines[component][j] = 0; + } } while (i >= frame->cache_offset[component] + COG_FRAME_CACHE_SIZE) {