From e04a0221e357c1b89bc11c284f06e7b31206cdfe Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 27 Nov 2021 09:36:44 -0800 Subject: [PATCH] Fixed crash running SDL test programs on UWP --- src/core/winrt/SDL_winrtapp_direct3d.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp index 4ed6f3639..929d1d3a7 100644 --- a/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp @@ -357,9 +357,16 @@ void SDL_WinRTApp::Run() { // TODO, WinRT: pass the C-style main() a reasonably realistic // representation of command line arguments. - int argc = 0; - char **argv = NULL; + int argc = 1; + char **argv = (char **)SDL_malloc(2 * sizeof(*argv)); + if (!argv) { + return; + } + argv[0] = SDL_strdup("WinRTApp"); + argv[1] = NULL; WINRT_SDLAppEntryPoint(argc, argv); + SDL_free(argv[0]); + SDL_free(argv); } }