From: Magnus Jacobsson Date: Wed, 9 Sep 2020 07:11:33 +0000 (+0200) Subject: Fix lefty crash at exit in MSBuild debug build X-Git-Tag: 2.46.0~20^2^2~87^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=153bd85f5f5f903d668ed6a78f2f2da705f1fd69;p=graphviz Fix lefty crash at exit in MSBuild debug build Final commit that fixes https://gitlab.com/graphviz/graphviz/-/issues/1818. --- diff --git a/cmd/lefty/lefty.c b/cmd/lefty/lefty.c index 633d9a20a..3ca82f298 100644 --- a/cmd/lefty/lefty.c +++ b/cmd/lefty/lefty.c @@ -213,6 +213,8 @@ int APIENTRY WinMain ( ) { Tobj co; Psrc_t src; + int argc; + LPWSTR *argv; hinstance = hInstance; hprevinstance = hPrevInstance; @@ -231,8 +233,11 @@ int APIENTRY WinMain ( Eshowcalls = 1; processstr (leftyoptions); - __argv++, __argc--; - processargs (__argc, __argv); + argv = CommandLineToArgvW(lpCmdLine, &argc); + if (argv == NULL) + return EXIT_FAILURE; + processargs(argc, argv); + LocalFree(argv); if (setjmp (exitljbuf)) goto eop;