From 151afec7f058fb39f18875162fcf97e70855e89b Mon Sep 17 00:00:00 2001 From: lisyarus Date: Sat, 4 Jul 2026 16:31:34 +0300 Subject: [PATCH] Fix app context lifetime in emscripten --- libs/sdl2/source/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/sdl2/source/main.cpp b/libs/sdl2/source/main.cpp index 1307cf03..1b39ce3f 100644 --- a/libs/sdl2/source/main.cpp +++ b/libs/sdl2/source/main.cpp @@ -20,6 +20,7 @@ { std::unique_ptr application; std::unique_ptr window; + psemek::app::application::context context; } em_state; #endif @@ -59,7 +60,11 @@ int main(int argc, char ** argv) try sdl2::window window(options); #endif +#ifdef __EMSCRIPTEN__ + auto & context = em_state.context; +#else app::application::context context; +#endif for (int i = 0; i < argc; ++i) context.args.push_back(argv[i]); context.show_cursor = [&](bool show){ window.show_cursor(show); };