Fix non-Unicode wxMSW build after command line arguments fixes

The changes of d979a7f0d8 (Fix memory leak of command line arguments in
wxMSW, 2022-12-26) broke compilation with wxUSE_UNICODE==0 as they were
backported from master where this case isn't possible any more.

Adjust these changes to work in non-Unicode build too.

See #23082, #23516.
This commit is contained in:
Vadim Zeitlin 2023-05-03 22:07:36 +02:00
parent 38c4b48509
commit cc46425f9f
2 changed files with 9 additions and 8 deletions

View File

@ -257,6 +257,7 @@ wxGTK:
wxMSW:
- Fix (deprecated) build without Unicode support broken in 3.2.2 (#23516).
- Fix setting locale for wxLANGUAGE_UKRAINIAN (Ulrich Telle, #23210).
- Don't reset custom wxToolBar background on system colour change (#23386).
- Fix wxUILocale::GetPreferredUILanguages() under < 10 (Brian Nixon, #23416).

View File

@ -197,7 +197,7 @@ int wxEntry(int& argc, wxChar **argv)
WXDLLIMPEXP_BASE void wxMSWCommandLineInit();
WXDLLIMPEXP_BASE void wxMSWCommandLineCleanup();
WXDLLIMPEXP_BASE int& wxMSWCommandLineGetArgc();
WXDLLIMPEXP_BASE wchar_t** wxMSWCommandLineGetArgv();
WXDLLIMPEXP_BASE wxChar** wxMSWCommandLineGetArgv();
#if wxUSE_BASE
@ -227,11 +227,6 @@ struct wxMSWCommandLineArguments
argc = 0;
}
}
~wxMSWCommandLineArguments()
{
Cleanup();
}
#else // !wxUSE_UNICODE
void Init()
{
@ -256,7 +251,7 @@ struct wxMSWCommandLineArguments
argv[argc] = NULL;
}
~wxMSWCommandLineArguments()
void Cleanup()
{
if ( !argc )
return;
@ -271,6 +266,11 @@ struct wxMSWCommandLineArguments
}
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
~wxMSWCommandLineArguments()
{
Cleanup();
}
int argc;
wxChar **argv;
@ -296,7 +296,7 @@ WXDLLIMPEXP_BASE int& wxMSWCommandLineGetArgc()
return wxArgs.argc;
}
WXDLLIMPEXP_BASE wchar_t** wxMSWCommandLineGetArgv()
WXDLLIMPEXP_BASE wxChar** wxMSWCommandLineGetArgv()
{
return wxArgs.argv;
}