Add a helper wxApp::GetValidTraits() method.
This method always returns some valid traits, even if we don't have wxTheApp (which is possible in the console applications) or if its GetTraits() was overridden to return NULL (which shouldn't be, but still guard against this). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74349 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -304,6 +304,15 @@ wxAppTraits *wxAppConsoleBase::GetTraitsIfExists()
|
||||
return app ? app->GetTraits() : NULL;
|
||||
}
|
||||
|
||||
/* static */
|
||||
wxAppTraits& wxAppConsoleBase::GetValidTraits()
|
||||
{
|
||||
static wxConsoleAppTraits s_traitsConsole;
|
||||
wxAppTraits* const traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
|
||||
|
||||
return traits ? *traits : s_traitsConsole;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxEventLoop redirection
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user