Rename wxInitData::InitializeFromWide() to InitIfNecessary()
And do nothing in this function if the arguments had been already initialized, as it will make it more convenient to call from other places. No real changes.
This commit is contained in:
parent
8cd33455fe
commit
d4484c48c4
2 changed files with 20 additions and 7 deletions
|
|
@ -25,9 +25,14 @@ struct WXDLLIMPEXP_BASE wxInitData
|
|||
// static, i.e. remain valid until the end of the program.
|
||||
void Initialize(int argc, char** argv);
|
||||
|
||||
// Initialize from wide command line arguments: here we currently make a
|
||||
// copy of the arguments internally, so they don't need to be static.
|
||||
void InitializeFromWide(int argc, wchar_t** argv);
|
||||
// Initialize from wide command line arguments if we hadn't been
|
||||
// initialized in some other way: this allows to call this function
|
||||
// unconditionally, even when these wide arguments were themselves
|
||||
// synthesized from ANSI ones by our own code.
|
||||
//
|
||||
// Note that here we currently make a copy of the arguments internally, so
|
||||
// they don't need to be static.
|
||||
void InitIfNecessary(int argc, wchar_t** argv);
|
||||
|
||||
// This function is used instead of the dtor because the global object can
|
||||
// be initialized multiple times.
|
||||
|
|
|
|||
|
|
@ -204,8 +204,18 @@ void wxInitData::MSWInitialize()
|
|||
|
||||
#endif // __WINDOWS__
|
||||
|
||||
void wxInitData::InitializeFromWide(int argcIn, wchar_t** argvIn)
|
||||
void wxInitData::InitIfNecessary(int argcIn, wchar_t** argvIn)
|
||||
{
|
||||
// Usually, arguments are initialized from "char**" passed to main()
|
||||
// elsewhere, but it is also possible to call a wide-char initialization
|
||||
// function (wxInitialize(), wxEntryStart() or wxEntry() itself) directly,
|
||||
// so we need to support this case too.
|
||||
if ( argc )
|
||||
{
|
||||
// Already initialized, nothing to do.
|
||||
return;
|
||||
}
|
||||
|
||||
// For simplicity, make a copy of the arguments, even though we could avoid
|
||||
// it -- but this would complicate the cleanup.
|
||||
argc = argcIn;
|
||||
|
|
@ -338,9 +348,7 @@ bool wxEntryStart(int& argc, wxChar **argv)
|
|||
// the MSW one, using the entire (wide) string command line do it, but if
|
||||
// this function is called directly from the application initialization
|
||||
// code this wouldn't be the case, and we need to handle this too
|
||||
auto& initData = wxInitData::Get();
|
||||
if ( !initData.argc )
|
||||
initData.InitializeFromWide(argc, argv);
|
||||
wxInitData::Get().InitIfNecessary(argc, argv);
|
||||
|
||||
// initialize wxRTTI
|
||||
if ( !DoCommonPreInit() )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue