From 54d25de3719137a71af3415d952f1f8eb1296d4c Mon Sep 17 00:00:00 2001 From: James Bursa Date: Fri, 30 Jul 2004 16:16:07 +0000 Subject: [project @ 2004-07-30 16:16:07 by bursa] Implement content_quit() and ro_gui_window_quit() to free resources on quit. svn path=/import/netsurf/; revision=1164 --- content/content.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'content/content.c') 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) { @@ -613,6 +613,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. * -- cgit v1.2.3