aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-20 16:16:52 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-03-20 16:16:52 -0700
commit22e4c333a7b17ba2e909b9118ef5fb6e4d0f5221 (patch)
treebeb28e562d57919e69dc2e7d64ec0da50c89914c
parent187d2517eebb3d92921f9183609f0aa681492f37 (diff)
fix test_emscripten_api_infloop
-rw-r--r--tests/emscripten_api_browser_infloop.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/emscripten_api_browser_infloop.cpp b/tests/emscripten_api_browser_infloop.cpp
index 0fd41922..1e9808da 100644
--- a/tests/emscripten_api_browser_infloop.cpp
+++ b/tests/emscripten_api_browser_infloop.cpp
@@ -8,17 +8,15 @@ struct Class {
int x;
Class() : x(0) {}
+ ~Class() { x = -9999; }
void print() {
- char buf[18];
- memset(buf, 0, 18); // clear stack. if we did not simulate infinite loop, this clears x and is a bug!
- x += buf[7];
-
printf("waka %d\n", x++);
- if (x == 7) {
+ if (x == 7 || x < 0) {
int result = x;
REPORT_RESULT();
+ emscripten_cancel_main_loop();
}
}
@@ -28,7 +26,9 @@ struct Class {
void start() {
instance = this;
- emscripten_set_main_loop(Class::callback, 3, 1); // important if we simulate an infinite loop here or not
+ // important if we simulate an infinite loop here or not. With an infinite loop, the
+ // destructor should *NOT* have been called
+ emscripten_set_main_loop(Class::callback, 3, 1);
}
};