Windows: Fix exit crash of GUI applications when deleting argv[].
When passing Qt arguments followed by normal arguments, a double deletion may occur due to Qt shifting argv. For example: argv[] = app -qwindowgeometry +50+50 some_arg <null> becomes: argv[] = app some_arg <null> some_arg <null> Terminate deletion when encountering the null pointer. Change-Id: I5279955b6bd463f5858d6e5e8e16a1f5d0945652 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
parent
3eca75de67
commit
d14397b729
@ -111,7 +111,7 @@ extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int
|
||||
argv[argc] = Q_NULLPTR;
|
||||
LocalFree(argvW);
|
||||
const int exitCode = main(argc, argv);
|
||||
for (int i = 0; i < argc; ++i)
|
||||
for (int i = 0; i < argc && argv[i]; ++i)
|
||||
delete [] argv[i];
|
||||
delete [] argv;
|
||||
return exitCode;
|
||||
|
Loading…
Reference in New Issue
Block a user