summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2009-09-25 18:14:28 -0700
committerDavid Schleef <ds@schleef.org>2009-10-02 21:58:26 -0700
commit3c870a7a6cb44976317b2723e7a1f02c2c9409fe (patch)
tree162e4da8fd11fc87b0d7f00929ae5e68ac87175f
parent05a1e071b9d1ad06536814e546d7256169654adf (diff)
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.
-rw-r--r--ext/cog/cogvirtframe.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/cog/cogvirtframe.c b/ext/cog/cogvirtframe.c
index eb6fc0052..36743039c 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) {