aboutsummaryrefslogtreecommitdiff
path: root/src/postamble.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-09 18:18:05 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-09 18:18:05 -0800
commitdfd9cf8cc063158cbaeecc81bc0e4b27ef6bec20 (patch)
treef30bb2c6b9912b455cd913a44131fc82e1f9c1f9 /src/postamble.js
parentbcce3b5fb4528a9a10f85cdcd11cf169a84350cd (diff)
prevent calling run more than once; fixes #1992
Diffstat (limited to 'src/postamble.js')
-rw-r--r--src/postamble.js7
1 files changed, 3 insertions, 4 deletions
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);