Skip to content

Commit 9a38d59

Browse files
committed
SWC: Fix stack overflow testing in editor on Emscripten debug builds
1 parent 336f6fc commit 9a38d59

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

source/supreme/game.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,9 @@ TASK(void) TestLevel(world_t *world,byte level)
828828
else if(result==WORLD_QUITGAME || result==WORLD_ABORT)
829829
break;
830830
}
831-
curWorld = {};
831+
// `curWorld = {};` is more C++ey here, but stack overflows on unoptimized Emscripten builds.
832+
// sizeof(world_t) ~= 776560 >> 65536 due to large embedded Tilegfx.
833+
memset(&curWorld, 0, sizeof(world_t));
832834
InitGuys(256);
833835
GetSpecialsFromMap(EditorGetMap()->special);
834836
editing=1;

0 commit comments

Comments
 (0)