1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

SMJS: fix segfault on exit

Create and immediately destroy a context when initialising the SMJS
document scripting module, because SMJS crashes on exit if there has
been no context created since it started, which is the case if one does
not load any documents.
This commit is contained in:
Miciah Dashiel Butler Masters 2006-03-02 03:14:10 +00:00 committed by Miciah Dashiel Butler Masters
parent dd93d35f4c
commit d7a964efaf

View File

@ -138,6 +138,11 @@ static void
spidermonkey_init(struct module *xxx)
{
jsrt = JS_NewRuntime(0x400000UL);
/* XXX: This is a hack to avoid a crash on exit. SMJS will crash
* on JS_DestroyRuntime if the given runtime has never had any context
* created, which will be the case if one closes ELinks without having
* loaded any documents. */
JS_DestroyContext(JS_NewContext(jsrt, 0));
}
static void