aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}
};