From dfd9cf8cc063158cbaeecc81bc0e4b27ef6bec20 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 9 Jan 2014 18:18:05 -0800 Subject: prevent calling run more than once; fixes #1992 --- src/postamble.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/postamble.js') diff --git a/src/postamble.js b/src/postamble.js index 63495914..d6c059b8 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -117,16 +117,15 @@ function run(args) { preRun(); - if (runDependencies > 0) { - // a preRun added a dependency, run will be called later - return; - } + if (runDependencies > 0) return; // a preRun added a dependency, run will be called later + if (Module['calledRun']) return; // run may have just been called through dependencies being fulfilled just in this very frame function doRun() { ensureInitRuntime(); preMain(); + assert(!Module['calledRun']); Module['calledRun'] = true; if (Module['_main'] && shouldRunNow) { Module['callMain'](args); -- cgit v1.2.3-18-g5258