1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-01-03 14:57:44 -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.

[ From commit d7a964efaf in ELinks
  0.12.GIT.  --KON ]
This commit is contained in:
Miciah Dashiel Butler Masters 2006-03-02 03:14:10 +00:00 committed by Kalle Olavi Niemitalo
parent 3d7a3f751b
commit 0fe04536b3

View File

@ -149,6 +149,11 @@ void
spidermonkey_init(void)
{
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));
}
void