Thursday, 28 June 2012

Patch: Call js_finalise after gui_quit()

Index: desktop/netsurf.c
===================================================================
--- desktop/netsurf.c (Revision 13994)
+++ desktop/netsurf.c (Arbeitskopie)
@@ -253,13 +253,14 @@

void netsurf_exit(void)
{
- js_finalise();
-
hlcache_stop();

LOG(("Closing GUI"));
gui_quit();

+ LOG(("Finalising JavaScript runtime"));
+ js_finalise();
+
LOG(("Closing search and related resources"));
search_web_cleanup();

Hello,

this patch changes the shutdown order. js_finalise() must be called
after gui_quit, otherwise, gui_quit() will try to free javascript
context belonging to a javascript runtime which is already shutdown.
(gui_quit closes / destroys all open windows, which means it also frees
the js contexts at that point).

Another approach would be to collect all available js context before
calling JS_DestroyRuntime().

Greets,
Ole

No comments:

Post a Comment