1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-19 00:05:36 +00:00

setTimeout: kill previous timer when planting a new one

Otherwise if the page installs multiple timers the old one would live
on unreferenced and possibly (likely) trigger after the document's death
and everything would go to hell.
This commit is contained in:
Petr Baudis 2006-11-05 00:53:04 +01:00 committed by Petr Baudis
parent 74997f772c
commit da5ec748b6

View File

@ -323,6 +323,7 @@ ecmascript_set_timeout(struct ecmascript_interpreter *interpreter, unsigned char
init_string(&interpreter->code);
add_to_string(&interpreter->code, code);
mem_free(code);
kill_timer(&interpreter->vs->doc_view->document->timeout);
install_timer(&interpreter->vs->doc_view->document->timeout, timeout, ecmascript_timeout_handler, interpreter);
}