summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-03-06 17:09:50 +0000
committerVincent Sanders <vince@kyllikki.org>2015-03-06 17:16:09 +0000
commitc4e551cd0cecf4ec9aba2d033cba3ca97e669463 (patch)
tree8831b672a74dd4dd02ab3cca7770ecb89be35ece
parent5d3cc513a3ecadb98ed8f6e34c4521db634e09cf (diff)
downloadnetsurf-c4e551cd0cecf4ec9aba2d033cba3ca97e669463.tar.gz
netsurf-c4e551cd0cecf4ec9aba2d033cba3ca97e669463.tar.bz2
clear the html content reference to javascript context.
When the browser window is about to be destroyed html_close gets called indicating the browser_window previously associated with the html content is about to become invalid. This makes the javascript context invalid within the html content (it is held by the browser window) when that context is about to be destroyed. Previously the javascript children would continue to attempt to use the context after it had been destroyed causing all sorts of strange errors and failures.
-rw-r--r--render/html.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/render/html.c b/render/html.c
index f3667d470..d1a61a4f3 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1538,8 +1538,16 @@ static void html_close(struct content *c)
if (html->search != NULL)
search_destroy_context(html->search);
+ /* clear the html content reference to the browser window */
html->bw = NULL;
+ /* clear the html content reference to the javascript context
+ * as it is about to become invalid and must not be used any
+ * more.
+ */
+ html->jscontext = NULL;
+
+ /* remove all object references from teh html content */
html_object_close_objects(html);
}