diff options
Diffstat (limited to 'content')
-rw-r--r-- | content/content.c | 33 | ||||
-rw-r--r-- | content/content.h | 1 |
2 files changed, 33 insertions, 1 deletions
diff --git a/content/content.c b/content/content.c index a30c72f2b..433169d6a 100644 --- a/content/content.c +++ b/content/content.c @@ -539,7 +539,7 @@ void content_clean(void) content_stop_check(c); } - /* attempt to shrike the memory cache (unused fresh contents) */ + /* attempt to shrink the memory cache (unused fresh contents) */ size = 0; next = 0; for (c = content_list; c; c = c->next) { @@ -614,6 +614,37 @@ void content_reset(struct content *c) /** + * Free all contents in the content_list. + */ + +void content_quit(void) +{ + bool progress = true; + struct content *c, *next; + + while (content_list && progress) { + progress = false; + for (c = content_list; c; c = next) { + next = c->next; + + if (c->user_list->next && + c->status != CONTENT_STATUS_ERROR) + /* content has users */ + continue; + + /* content can be destroyed */ + content_destroy(c); + progress = true; + } + } + + if (content_list) { + LOG(("bug: some contents could not be destroyed")); + } +} + + +/** * Display content on screen. * * Calls the redraw function for the content, if it exists. diff --git a/content/content.h b/content/content.h index e441e6b36..b82a02ebc 100644 --- a/content/content.h +++ b/content/content.h @@ -268,6 +268,7 @@ void content_convert(struct content *c, int width, int height); void content_reformat(struct content *c, int width, int height); void content_clean(void); void content_reset(struct content *c); +void content_quit(void); void content_redraw(struct content *c, int x, int y, int width, int height, int clip_x0, int clip_y0, int clip_x1, int clip_y1, |