mirror of
https://github.com/rkd77/elinks.git
synced 2025-09-21 19:46:23 -04: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:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user